You are here

public function DashboardConfigureBlockForm::submitForm in Draggable dashboard 8.2

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

Throws

\Drupal\Core\Entity\EntityStorageException

Overrides DashboardBlockFormBase::submitForm

File

src/Form/DashboardConfigureBlockForm.php, line 65

Class

DashboardConfigureBlockForm
Class DashboardConfigureBlockForm

Namespace

Drupal\draggable_dashboard\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $blocks = $this->dashboard
    ->get('blocks') ? $this->dashboard
    ->get('blocks') : [];
  $blocks[$this->block_id]['settings'] = $form_state
    ->getValue('settings');

  // Save relation.
  $this->dashboard
    ->set('blocks', $blocks)
    ->save();

  // Redirect to manage blocks screen.
  $form_state
    ->setRedirect('entity.dashboard_entity.edit_form', [
    'dashboard_entity' => $this->dashboard
      ->id(),
  ]);
}