You are here

protected function MoveBlockForm::getSelectedDelta in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Form/MoveBlockForm.php \Drupal\layout_builder\Form\MoveBlockForm::getSelectedDelta()
  2. 9 core/modules/layout_builder/src/Form/MoveBlockForm.php \Drupal\layout_builder\Form\MoveBlockForm::getSelectedDelta()

Gets the selected delta.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

int The section delta.

2 calls to MoveBlockForm::getSelectedDelta()
MoveBlockForm::buildForm in core/modules/layout_builder/src/Form/MoveBlockForm.php
Builds the move block form.
MoveBlockForm::submitForm in core/modules/layout_builder/src/Form/MoveBlockForm.php
Form submission handler.

File

core/modules/layout_builder/src/Form/MoveBlockForm.php, line 311

Class

MoveBlockForm
Provides a form for moving a block.

Namespace

Drupal\layout_builder\Form

Code

protected function getSelectedDelta(FormStateInterface $form_state) {
  if ($form_state
    ->hasValue('region')) {
    return (int) explode(':', $form_state
      ->getValue('region'))[0];
  }
  return (int) $this->delta;
}