public function DashboardAssignBlockForm::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/ DashboardAssignBlockForm.php, line 100
Class
- DashboardAssignBlockForm
- Class DashboardAssignBlockForm
Namespace
Drupal\draggable_dashboard\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$settings = $form_state
->getValue('settings');
$id = $form_state
->getValue('id');
$region = $form_state
->getValue('column');
$blocks = $this->dashboard
->get('blocks') ? $this->dashboard
->get('blocks') : [];
$blocks[$id] = [
'column' => (int) $region,
'settings' => $settings,
'weight' => 0,
];
// 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(),
]);
}