bootstrap3-1.0.1/src/Plugin/Setting/JavaScript/Popovers/PopoverAnimation.php
src/Plugin/Setting/JavaScript/Popovers/PopoverAnimation.php
<?php
namespace Drupal\bootstrap3\Plugin\Setting\JavaScript\Popovers;
use Drupal\bootstrap3\Plugin\Setting\SettingBase;
use Drupal\bootstrap3\Utility\Element;
use Drupal\Core\Form\FormStateInterface;
/**
* The "popover_animation" theme setting.
*
* @ingroup plugins_setting
*
* @BootstrapSetting(
* id = "popover_animation",
* type = "checkbox",
* title = @Translation("animation"),
* description = @Translation("Apply a CSS fade transition to the popover."),
* defaultValue = 1,
* groups = {
* "javascript" = @Translation("JavaScript"),
* "popovers" = @Translation("Popovers"),
* "options" = @Translation("Options"),
* },
* )
*/
class PopoverAnimation extends SettingBase {
/**
* {@inheritdoc}
*/
public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
parent::alterFormElement($form, $form_state, $form_id);
$group = $this->getGroupElement($form, $form_state);
$group->setProperty('description', $this->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>.'));
$group->setProperty('states', [
'visible' => [
':input[name="popover_enabled"]' => ['checked' => TRUE],
],
]);
}
/**
* {@inheritdoc}
*/
public function drupalSettings() {
return !!$this->theme->getSetting('popover_enabled');
}
}
