You are here

public function LayoutBuilderIdsConfigureBlock::LayoutBuilderIdsSubmitForm in Layout builder ids 8

File

src/EventSubscriber/LayoutBuilderIdsConfigureBlock.php, line 50

Class

LayoutBuilderIdsConfigureBlock
Class LayoutBuilderIdsConfigureBlock.

Namespace

Drupal\layout_builder_ids\EventSubscriber

Code

public function LayoutBuilderIdsSubmitForm(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));
  }
}