3 namespace Drupal\bootstrap\Plugin\Setting\JavaScript\Popovers;
5 use Drupal\bootstrap\Plugin\Setting\SettingBase;
6 use Drupal\bootstrap\Utility\Element;
7 use Drupal\Core\Form\FormStateInterface;
10 * The "popover_animation" theme setting.
12 * @ingroup plugins_setting
15 * id = "popover_animation",
17 * title = @Translation("animation"),
18 * description = @Translation("Apply a CSS fade transition to the popover."),
21 * "javascript" = @Translation("JavaScript"),
22 * "popovers" = @Translation("Popovers"),
23 * "options" = @Translation("Options"),
27 class PopoverAnimation extends SettingBase {
32 public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
33 parent::alterFormElement($form, $form_state, $form_id);
35 $group = $this->getGroupElement($form, $form_state);
36 $group->setProperty('description', t('These are global options. Each popover can independently override desired settings by appending the option name to <code>data-</code>. Example: <code>data-animation="false"</code>.'));
37 $group->setProperty('states', [
39 ':input[name="popover_enabled"]' => ['checked' => TRUE],
47 public function drupalSettings() {
48 return !!$this->theme->getSetting('popover_enabled');