--- /dev/null
+<?php
+
+namespace Drupal\bootstrap\Plugin\Setting\JavaScript\Modals;
+
+use Drupal\bootstrap\Plugin\Setting\SettingBase;
+use Drupal\bootstrap\Utility\Element;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * The "modal_select_text" theme setting.
+ *
+ * @ingroup plugins_setting
+ *
+ * @BootstrapSetting(
+ * id = "modal_select_text",
+ * type = "checkbox",
+ * title = @Translation("selectText"),
+ * description = @Translation("Enabling this selects the text of the first available and visible input found after it has been focused."),
+ * defaultValue = 1,
+ * groups = {
+ * "javascript" = @Translation("JavaScript"),
+ * "modals" = @Translation("Modals"),
+ * "options" = @Translation("Options"),
+ * },
+ * )
+ */
+class ModalSelectText extends SettingBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
+ parent::alterFormElement($form, $form_state, $form_id);
+ $setting = $this->getSettingElement($form, $form_state);
+ $setting->setProperty('states', [
+ 'visible' => [
+ ':input[name="modal_enabled"]' => ['checked' => TRUE],
+ ':input[name="modal_focus_input"]' => ['checked' => TRUE],
+ ],
+ ]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function drupalSettings() {
+ return !!$this->theme->getSetting('modal_enabled');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheTags() {
+ return ['rendered', 'library_info'];
+ }
+
+}