public static function LayoutBuilderIdsConfigureBlock::layoutBuilderIdsConfigureBlockSubmitForm in Layout builder ids 2.0.x
File
- src/
EventSubscriber/ LayoutBuilderIdsConfigureBlock.php, line 111
Class
- LayoutBuilderIdsConfigureBlock
- Add block ids to layout builder sections.
Namespace
Drupal\layout_builder_ids\EventSubscriberCode
public static function layoutBuilderIdsConfigureBlockSubmitForm(array &$form, FormStateInterface $form_state) {
// Load in the layout_builder_id.
$layout_builder_id = $form_state
->getValue([
'settings',
'layout_builder_id',
]);
// If there is in id, save it in config.
if ($layout_builder_id !== NULL) {
// Load in the component/block.
$component = $form_state
->getFormObject()
->getCurrentComponent();
// Set the layout_builder_id.
$component
->set('layout_builder_id', Html::getId($layout_builder_id));
}
}