function public function ModalAnimation::alterFormElement

8.x-3.x ModalAnimation.php public ModalAnimation::alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL)

The alter method to store the code.


\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


The "modal_animation" theme setting.



Source src/Plugin/Setting/JavaScript/Modals/ModalAnimation.php (line 32)

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->note = [
    '#type' => 'container',
    '#weight' => -1,
    '#attributes' => ['class' => ['alert', 'alert-info', 'alert-sm']],
    0 => [
      '#markup' => t('<strong>Note:</strong> jQuery UI dialog options will be mapped to Bootstrap modal options whenever possible, however they always take precedent over any global Bootstrap modal options set here for compatibility reasons.'),
    '#states' => [
      'visible' => [
        ':input[name="modal_enabled"]' => ['checked' => TRUE],
        ':input[name="modal_jquery_ui_bridge"]' => ['checked' => TRUE],
  $group->setProperty('description', t('These are global options. Each modal can independently override desired settings by appending the option name to <code>data-</code>. Example: <code>data-backdrop="false"</code>.'));
  $group->setProperty('states', [
    'visible' => [
      ':input[name="modal_enabled"]' => ['checked' => TRUE],