Version 1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Setting / JavaScript / Modals / ModalEnabled.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Setting\JavaScript\Modals\ModalEnabled.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Setting\JavaScript\Modals;
8
9 use Drupal\bootstrap\Annotation\BootstrapSetting;
10 use Drupal\bootstrap\Plugin\Setting\SettingBase;
11 use Drupal\bootstrap\Utility\Element;
12 use Drupal\Core\Annotation\Translation;
13 use Drupal\Core\Form\FormStateInterface;
14
15 /**
16  * The "modal_enabled" theme setting.
17  *
18  * @ingroup plugins_setting
19  *
20  * @BootstrapSetting(
21  *   id = "modal_enabled",
22  *   type = "checkbox",
23  *   title = @Translation("Enable Bootstrap Modals"),
24  *   description = @Translation("Enabling this will replace core's jQuery UI Dialog implementations with modals from the Bootstrap Framework."),
25  *   defaultValue = 1,
26  *   weight = -1,
27  *   groups = {
28  *     "javascript" = @Translation("JavaScript"),
29  *     "modals" = @Translation("Modals"),
30  *   },
31  * )
32  */
33 class ModalEnabled extends SettingBase {
34
35   /**
36    * {@inheritdoc}
37    */
38   public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
39     parent::alterFormElement($form, $form_state, $form_id);
40     $group = $this->getGroupElement($form, $form_state);
41     $group->setProperty('description', t('Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults. See <a href=":url" target="_blank">Bootstrap Modals</a> for more documentation.', [
42       ':url' => 'http://getbootstrap.com/javascript/#modals',
43     ]));
44   }
45
46   /**
47    * {@inheritdoc}
48    */
49   public function getCacheTags() {
50     return ['rendered', 'library_info'];
51   }
52
53 }