public function FormAlter::alterConfigureForm in Layout Builder UX 8
Alters the section configuration form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Form/ FormAlter.php, line 24
Class
- FormAlter
- Alters forms, delegated by hook_form_alter() implementations.
Namespace
Drupal\lb_ux\FormCode
public function alterConfigureForm(array &$form, FormStateInterface $form_state) {
if ($this
->isAjax()) {
// Allow the forms loaded into off-canvas to display status messages.
if (!isset($form['status_messages'])) {
$form['status_messages'] = [
'#type' => 'status_messages',
];
}
// @todo static::ajaxSubmit() requires data-drupal-selector to be the same
// between the various Ajax requests. A bug in
// \Drupal\Core\Form\FormBuilder prevents that from happening unless
// $form['#id'] is also the same. Normally, #id is set to a unique HTML
// ID via Html::getUniqueId(), but here we bypass that in order to work
// around the data-drupal-selector bug. This is okay so long as we
// assume that this form only ever occurs once on a page. Remove this
// workaround in https://www.drupal.org/node/2897377.
$form['#id'] = Html::getId($form_state
->getBuildInfo()['form_id']);
}
}