You are here

public function InlineBlock::blockValidate in Drupal 10

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

File

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

Class

InlineBlock
Defines an inline block plugin type.

Namespace

Drupal\layout_builder\Plugin\Block

Code

public function blockValidate($form, FormStateInterface $form_state) {
  $block_form = $form['block_form'];

  /** @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);
  $form_display
    ->validateFormValues($block, $block_form, $complete_form_state);

  // @todo Remove when https://www.drupal.org/project/drupal/issues/2948549 is closed.
  $form_state
    ->setTemporaryValue('block_form_parents', $block_form['#parents']);
}