diff --git a/config/install/paragraphs_gridstack.optionset.default.yml b/config/install/paragraphs_gridstack.optionset.default.yml index b4531ab8a9ab4f98815a72de701e199c8a4f7015..9aabe6a6b392fc8332d31951992be83f75f40785 100644 --- a/config/install/paragraphs_gridstack.optionset.default.yml +++ b/config/install/paragraphs_gridstack.optionset.default.yml @@ -6,3 +6,4 @@ label: Default float: true allow_custom_class: false breakpoints_provider: 'paragraphs_gridstack' +styles_list: { } diff --git a/config/schema/paragraphs_gridstack.schema.yml b/config/schema/paragraphs_gridstack.schema.yml index 4f38ef54838609042898cf4201c77eb35b8d1c9c..c93d7ee21d7760503bf53ff44880cd43477f3ce3 100644 --- a/config/schema/paragraphs_gridstack.schema.yml +++ b/config/schema/paragraphs_gridstack.schema.yml @@ -27,3 +27,6 @@ paragraphs_gridstack.optionset.*: breakpoints_provider: type: string label: "Breakpoints provider" + styles_list: + type: string + label: "Styles list" diff --git a/modules/paragraphs_gridstack_demo/config/install/paragraphs_gridstack.optionset.demo.yml b/modules/paragraphs_gridstack_demo/config/install/paragraphs_gridstack.optionset.demo.yml index f9f9167b6d4225f9b5466878a66997de21f60f62..f694a95927b2bffcba70c56c98ef6d5755f0e6a9 100644 --- a/modules/paragraphs_gridstack_demo/config/install/paragraphs_gridstack.optionset.demo.yml +++ b/modules/paragraphs_gridstack_demo/config/install/paragraphs_gridstack.optionset.demo.yml @@ -6,3 +6,4 @@ label: Demo float: true allow_custom_class: true breakpoints_provider: paragraphs_gridstack +styles_list: { } diff --git a/src/Entity/ParagraphsGridstack.php b/src/Entity/ParagraphsGridstack.php index 0b786df78fd2365296190366a905100a7113c539..066ba23cbab5887ba29920ecb589975c222e2c94 100644 --- a/src/Entity/ParagraphsGridstack.php +++ b/src/Entity/ParagraphsGridstack.php @@ -63,6 +63,7 @@ use Drupal\Core\Entity\Annotation\ConfigEntityType; * "allow_custom_class", * "breakpoints_provider", * "template", + * "styles_list", * } * ) */ @@ -117,4 +118,11 @@ class ParagraphsGridstack extends ConfigEntityBase { */ public $template; + /** + * Allows you to select a css class for an element. + * + * @var string + */ + public $styles_list; + } diff --git a/src/Form/ParagraphsGridstackFormBase.php b/src/Form/ParagraphsGridstackFormBase.php index 14e4114823d2973dea17c9ce03a12ac622be1f8e..ea1caff0fae6cbf6466c87a9bf961e378eb7e82b 100644 --- a/src/Form/ParagraphsGridstackFormBase.php +++ b/src/Form/ParagraphsGridstackFormBase.php @@ -127,6 +127,18 @@ class ParagraphsGridstackFormBase extends EntityForm { '#default_value' => $paragraphsGridstack->allow_custom_class ?? FALSE, ]; + $form['styles_list'] = [ + '#type' => 'textarea', + '#title' => $this->t('Styles list'), + '#default_value' => $paragraphsGridstack->styles_list ?? FALSE, + '#description' => $this->t('Enter one or more classes on each line in the format: element.classA.classB|Label.'), + '#states' => [ + 'visible' => [ + ':input[name="allow_custom_class"]' => ['checked' => TRUE], + ], + ], + ]; + // Load the list of the breakpoints providers. // Get the default provider and validate available provider. $options = $this->gridstackBreakpointsManager->getBreakpointsProvidersList();