-
Notifications
You must be signed in to change notification settings - Fork 207
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 Configurable #1118
Comments
Maybe a block can implement variations like this: public function configurable()
{
return [
'class', 'otherVar',
]
} inside the config: 'cms' => [
'blockVariation' => [
'theNameOfTheBlock' => [
'green' => ['class' => 'text-green'],
'red' => ['class' => 'text-red', 'otherVar' => 'this-and-that']
]
]
] Now the provided red variation will define the defaultValue of
|
Maybe it makes sense to split the individual variables into multiple selects in the administration and configure them like this: // In the block definition
public function configurable()
{
return [
'background-color', 'border-color',
]
}
// In the project config
'cms' => [
'blocks' => [
'textBlock' => [
'background-color' => [
['value' => '#f00', 'label' => 'Red'],
['value' => '#ff0', 'label' => 'Yellow'],
],
'border-color' => [
['value' => '#fff', 'label' => 'White'],
['value' => '#000', 'label' => 'Black'],
]
]
]
]
|
so in your case like this: public function config()
{
return [
'vars' => [
['var' => 'background-color', 'type' => 'zaa-text', 'label' => 'Color'],
]
];
} |
I think the variation should contain the variables and not the other way around.
|
order to override and hide fields. #1118
Some of the CMS blocks must have Variations in order to support multiple template schemas inside just one block.
Example:
The paragraph block (Text Block) can be used within different contexts:
context1:
context2:
So the user should have abilities to pick a variation for the matching use case.
Questions:
Should the block render different templates or just predefined configuration variables (like a preset value for $class)
The text was updated successfully, but these errors were encountered: