You are here

public function InlineBlock::blockSubmit in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/Block/InlineBlock.php \Drupal\layout_builder\Plugin\Block\InlineBlock::blockSubmit()

Overrides BlockPluginTrait::blockSubmit

File

core/modules/layout_builder/src/Plugin/Block/InlineBlock.php, line 194

Class

InlineBlock
Defines an inline block plugin type.

Namespace

Drupal\layout_builder\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $this->configuration['view_mode'] = $form_state
    ->getValue('view_mode');

  // @todo Remove when https://www.drupal.org/project/drupal/issues/2948549 is closed.
  $block_form = NestedArray::getValue($form, $form_state
    ->getTemporaryValue('block_form_parents'));

  /** @var \Drupal\block_content\BlockContentInterface $block */
  $block = $block_form['#block'];
  $form_display = EntityFormDisplay::collectRenderDisplay($block, 'edit');
  $complete_form_state = $form_state instanceof SubformStateInterface ? $form_state
    ->getCompleteFormState() : $form_state;
  $form_display
    ->extractFormValues($block, $block_form, $complete_form_state);
  $block
    ->setInfo($this->configuration['label']);
  $this->configuration['block_serialized'] = serialize($block);
}