function MoveBlockForm::getSelectedDelta

Same name in other branches
  1. 8.9.x core/modules/layout_builder/src/Form/MoveBlockForm.php \Drupal\layout_builder\Form\MoveBlockForm::getSelectedDelta()
  2. 10 core/modules/layout_builder/src/Form/MoveBlockForm.php \Drupal\layout_builder\Form\MoveBlockForm::getSelectedDelta()
  3. 11.x 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 313

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.