diff --git a/config/schema/paragraphs_collection.schema.yml b/config/schema/paragraphs_collection.schema.yml index fa7a055..4a69ad9 100644 --- a/config/schema/paragraphs_collection.schema.yml +++ b/config/schema/paragraphs_collection.schema.yml @@ -2,11 +2,17 @@ paragraphs.behavior.settings.style: type: paragraphs.behavior.settings_base mapping: group: - type: string + type: sequence label: Style group + sequence: + type: string default: type: string label: Default style + deafults: + type: sequence + sequence: + type: string paragraphs.behavior.settings.grid_layout: type: paragraphs.behavior.settings_base mapping: diff --git a/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php b/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php index 75e08a6..eec0744 100644 --- a/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php +++ b/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php @@ -130,6 +130,7 @@ class ParagraphsStylePlugin extends ParagraphsBehaviorBase implements ContainerF public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['group'] = [ '#type' => 'select', + '#multiple' => TRUE, '#empty_option' => $this->t('- None -'), '#options' => $this->yamlStyleDiscovery->getStyleGroups(), '#title' => $this->t('Style group'), @@ -142,17 +143,37 @@ class ParagraphsStylePlugin extends ParagraphsBehaviorBase implements ContainerF ]; // @todo: Remove getCompleteFormState() after https://www.drupal.org/project/drupal/issues/2798261. $group_key = ['behavior_plugins', $this->getPluginId(), 'settings', 'group']; - $group = $form_state->getCompleteFormState()->getValue($group_key, $this->configuration['group']); - $form['default'] = [ - '#type' => 'select', - '#empty_option' => $this->t('- None -'), - '#options' => $this->yamlStyleDiscovery->getStyleOptions($group), - '#title' => $this->t('Default style'), - '#description' => $this->t('This style will be default option on a behavior form.'), - '#default_value' => $this->configuration['default'], - '#prefix' => '