public function ComponentFormBase::afterBuild in Layout Paragraphs 2.0.x
After build callback fixes issues with data-drupal-selector.
See https://www.drupal.org/project/drupal/issues/2897377
Parameters
array $element: The form element.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
Return value
array The form element.
File
- src/
Form/ ComponentFormBase.php, line 332
Class
- ComponentFormBase
- Class LayoutParagraphsComponentFormBase.
Namespace
Drupal\layout_paragraphs\FormCode
public function afterBuild(array $element, FormStateInterface $form_state) {
$parents = array_merge($element['#parents'], [
$this
->getFormId(),
]);
$unprocessed_id = 'edit-' . implode('-', $parents);
$element['#attributes']['data-drupal-selector'] = Html::getId($unprocessed_id);
$element['#dialog_id'] = $unprocessed_id . '-dialog';
return $element;
}