3 namespace Drupal\bootstrap\Plugin\Setting\JavaScript\Modals;
5 use Drupal\bootstrap\Plugin\Setting\SettingBase;
6 use Drupal\bootstrap\Utility\Element;
7 use Drupal\Core\Form\FormStateInterface;
10 * The "modal_select_text" theme setting.
12 * @ingroup plugins_setting
15 * id = "modal_select_text",
17 * title = @Translation("selectText"),
18 * description = @Translation("Enabling this selects the text of the first available and visible input found after it has been focused."),
21 * "javascript" = @Translation("JavaScript"),
22 * "modals" = @Translation("Modals"),
23 * "options" = @Translation("Options"),
27 class ModalSelectText extends SettingBase {
32 public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
33 parent::alterFormElement($form, $form_state, $form_id);
34 $setting = $this->getSettingElement($form, $form_state);
35 $setting->setProperty('states', [
37 ':input[name="modal_enabled"]' => ['checked' => TRUE],
38 ':input[name="modal_focus_input"]' => ['checked' => TRUE],
46 public function drupalSettings() {
47 return !!$this->theme->getSetting('modal_enabled');
53 public function getCacheTags() {
54 return ['rendered', 'library_info'];