You are here

protected function DashboardDeleteBlockForm::init in Draggable dashboard 8.2

Initialize the form state and the entity before the first form build.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

\Drupal\draggable_dashboard\Entity\DashboardEntityInterface $dashboard_entity: Dashboard object.

string $block_id: ID of the block to delete.

1 call to DashboardDeleteBlockForm::init()
DashboardDeleteBlockForm::buildForm in src/Form/DashboardDeleteBlockForm.php

File

src/Form/DashboardDeleteBlockForm.php, line 62

Class

DashboardDeleteBlockForm
Class DashboardDeleteBlockForm

Namespace

Drupal\draggable_dashboard\Form

Code

protected function init(FormStateInterface $form_state, DashboardEntityInterface $dashboard_entity, $block_id) {

  // Flag that this form has been initialized.
  $form_state
    ->set('form_initialized', TRUE);
  $this->dashboard = $dashboard_entity;
  $blocks = $dashboard_entity
    ->get('blocks');
  if (!empty($blocks[$block_id])) {
    $this->block = $blocks[$block_id];
  }
}