class TooltipEnabled

The "tooltip_enabled" theme setting.

Plugin annotation

@BootstrapSetting(
  id = "tooltip_enabled",
  type = "checkbox",
  title = @Translation("Enable Bootstrap Tooltips"),
  description = @Translation("Elements that have the <code>data-toggle=&quote;tooltip&quote;</code> attribute set will automatically initialize the tooltip upon page load. <strong class='error text-error'>WARNING: This feature can sometimes impact performance. Disable if pages appear to &quote;hang&quote; after initial load.</strong>"),
  defaultValue = 1,
  weight = -1,
  groups = {
    "javascript" = @Translation("JavaScript"),
    "tooltips" = @Translation("Tooltips"),
  },
)

Hierarchy

Expanded class hierarchy of TooltipEnabled

Related topics

Namespace

Drupal\bootstrap\Plugin\Setting\JavaScript\Tooltips
Source
class TooltipEnabled 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', t('Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don\'t rely on images, use CSS3 for animations, and data-attributes for local title storage. See <a href=":url" target="_blank">Bootstrap tooltips</a> for more documentation.', [
      ':url' => 'http://getbootstrap.com/javascript/#tooltips',
    ]));
  }

  /**
   * {@inheritdoc}
   */
  public function drupalSettings() {
    return !!$this->theme->getSetting('tooltip_enabled');
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
SettingBase::alterForm public function The alter method to store the code. Overrides FormInterface::alterForm
SettingBase::getCacheTags public function The cache tags associated with this object. Overrides SettingInterface::getCacheTags
SettingBase::getDefaultValue public function Retrieves the setting's default value. Overrides SettingInterface::getDefaultValue
SettingBase::getElement Deprecated public function Overrides SettingInterface::getElement
SettingBase::getElementProperties public function Retrieves all the form properties from the setting definition.
SettingBase::getGroup Deprecated public function Overrides SettingInterface::getGroup
SettingBase::getGroupElement public function Retrieves the group form element the setting belongs to. Overrides SettingInterface::getGroupElement
SettingBase::getGroups public function Retrieves the setting's groups. Overrides SettingInterface::getGroups
SettingBase::getOptions public function Retrieves the settings options, if set. Overrides SettingInterface::getOptions
SettingBase::getSettingElement public function Retrieves the form element for the setting. Overrides SettingInterface::getSettingElement
SettingBase::getTitle public function Retrieves the setting's human-readable title. Overrides SettingInterface::getTitle
SettingBase::submitForm public static function Form submission handler. Overrides FormInterface::submitForm
SettingBase::submitFormElement public static function Form submission handler. Overrides FormInterface::submitFormElement
SettingBase::validateForm public static function Form validation handler. Overrides FormInterface::validateForm
SettingBase::validateFormElement public static function Form validation handler. Overrides FormInterface::validateFormElement
TooltipEnabled::alterFormElement public function The alter method to store the code. Overrides SettingBase::alterFormElement
TooltipEnabled::drupalSettings public function Determines whether a theme setting should added to drupalSettings. Overrides SettingBase::drupalSettings