You are here

public function TooltipAnimation::alterFormElement in Express 8

The alter method to store the code.

Parameters

\Drupal\bootstrap\Utility\Element $form: The Element object that comprises the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

string $form_id: String representing the name of the form itself. Typically this is the name of the function that generated the form.

Overrides SettingBase::alterFormElement

File

themes/contrib/bootstrap/src/Plugin/Setting/JavaScript/Tooltips/TooltipAnimation.php, line 38
Contains \Drupal\bootstrap\Plugin\Setting\JavaScript\Tooltips\TooltipAnimation.

Class

TooltipAnimation
The "tooltip_animation" theme setting.

Namespace

Drupal\bootstrap\Plugin\Setting\JavaScript\Tooltips

Code

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('These are global options. Each tooltip 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="tooltip_enabled"]' => [
        'checked' => TRUE,
      ],
    ],
  ]);
}