Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block variation "default" #86

Closed
TheMaaarc opened this issue Jun 6, 2018 · 2 comments · Fixed by #150
Closed

Block variation "default" #86

TheMaaarc opened this issue Jun 6, 2018 · 2 comments · Fixed by #150
Assignees

Comments

@TheMaaarc
Copy link
Member

It would be nice to have the possibility to change the blocks default values through a "default" variation.

Maybe something like this would work?

TextBlock::variations()
    ->add('default')->vars(['textType' => 1])
    ->register()

Technically it would still be a "variation" even tho it's the default one that can't be chosen by the user.

Use cases:
Title block: Limit the type dropdown to only h1 and h2, add default css class
Text block: Enable markdown by default, add default css class
...

@nadar
Copy link
Member

nadar commented Jun 9, 2018

I agree with this missing function, sometimes it would be very useful to apply a default class for images. The approach you provided looks almost good to me. Maybe using something like this:

TextBlock::variations()->default()->vars(['textType' => 1])->register()

Is now default() would be available in your IDE while typing.

@nadar nadar self-assigned this Jun 9, 2018
@boehsermoe boehsermoe mentioned this issue Oct 17, 2018
nadar added a commit that referenced this issue Oct 26, 2018
add option to set default variation #86
nadar added a commit that referenced this issue Oct 26, 2018
@nadar nadar reopened this Oct 28, 2018
@nadar
Copy link
Member

nadar commented Oct 28, 2018

rename default to asDefault()

PHP Parse error: syntax error, unexpected 'default' (T_DEFAULT), expecting
identifier (T_STRING)

@nadar nadar closed this as completed in 7618a1b Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants