function public function ModalSelectText::alterFormElement

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

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

Class

ModalSelectText
The "modal_select_text" theme setting.

Namespace

Drupal\bootstrap\Plugin\Setting\JavaScript\Modals

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

public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
  parent::alterFormElement($form, $form_state, $form_id);
  $setting = $this->getSettingElement($form, $form_state);
  $setting->setProperty('states', [
    'visible' => [
      ':input[name="modal_enabled"]' => ['checked' => TRUE],
      ':input[name="modal_focus_input"]' => ['checked' => TRUE],
    ],
  ]);
}