public function DashboardEditForm::buildForm in Draggable dashboard 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides DashboardFormBase::buildForm
File
- src/
Form/ DashboardEditForm.php, line 31
Class
- DashboardEditForm
- Provides the draggable dashboard edit form.
Namespace
Drupal\draggable_dashboard\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $did = NULL) {
$form = parent::buildForm($form, $form_state, $did);
$form['#title'] = $this->dashboard
->get('title');
$form['did'] = [
'#type' => 'hidden',
'#value' => $this->dashboard
->id(),
];
$url = new Url('draggable_dashboard.delete_dashboard', [
'did' => $this->dashboard
->id(),
]);
$form['actions']['delete'] = [
'#type' => 'link',
'#title' => $this
->t('Delete'),
'#url' => $url,
'#attributes' => [
'class' => [
'button',
'button--danger',
],
],
];
return $form;
}