From 01526eb25ede952334c565c6417eae64f5039a35 Mon Sep 17 00:00:00 2001 From: christian medders Date: Mon, 28 Oct 2024 14:23:38 -0400 Subject: [PATCH] DIGITAL-28: Update to do/dont table with new module --- .../ECShortcodesDoDontTable.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/web/modules/custom/ec_shortcodes/src/Plugin/EmbeddedContent/ECShortcodesDoDontTable.php b/web/modules/custom/ec_shortcodes/src/Plugin/EmbeddedContent/ECShortcodesDoDontTable.php index fb023d47..740f0c4f 100644 --- a/web/modules/custom/ec_shortcodes/src/Plugin/EmbeddedContent/ECShortcodesDoDontTable.php +++ b/web/modules/custom/ec_shortcodes/src/Plugin/EmbeddedContent/ECShortcodesDoDontTable.php @@ -6,6 +6,7 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\embedded_content\EmbeddedContentInterface; use Drupal\embedded_content\EmbeddedContentPluginBase; +use Drupal\multivalue_form_element\Element\MultiValue; /** * Plugin iframes. @@ -27,6 +28,7 @@ public function defaultConfiguration() { return [ 'heading' => NULL, 'text' => NULL, + 'checklist' => NULL, ]; } @@ -38,6 +40,7 @@ public function build(): array { '#theme' => 'ec_shortcodes_do_dont_table', '#heading' => $this->configuration['text'], '#text' => $this->configuration['text'], + '#checklist' => $this->configuration['checklist'], ]; } @@ -57,6 +60,23 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#default_value' => $this->configuration['text'], '#required' => TRUE, ]; + $form['checklist'] = [ + '#type' => 'multivalue', + '#title' => $this->t("Do/Don't Table"), + '#add_more_label' => $this->t('Add Row'), + '#cardinality' => MultiValue::CARDINALITY_UNLIMITED, + '#default_value' => $this->configuration['checklist'], + 'checkbox' => [ + '#type' => 'textarea', + '#title' => $this->t('Do'), + '#description' => $this->t('This will add text for the Do Colum'), + ], + 'sublist' => [ + '#type' => 'textarea', + '#title' => $this->t("Don't"), + '#description' => $this->t("This will add text for the Don't Colum"), + ], + ]; return $form; }