function WorkflowStateEditForm::actions

Same name in other branches
  1. 8.9.x core/modules/workflows/src/Form/WorkflowStateEditForm.php \Drupal\workflows\Form\WorkflowStateEditForm::actions()
  2. 10 core/modules/workflows/src/Form/WorkflowStateEditForm.php \Drupal\workflows\Form\WorkflowStateEditForm::actions()
  3. 11.x core/modules/workflows/src/Form/WorkflowStateEditForm.php \Drupal\workflows\Form\WorkflowStateEditForm::actions()

Overrides EntityForm::actions

File

core/modules/workflows/src/Form/WorkflowStateEditForm.php, line 217

Class

WorkflowStateEditForm
Entity form variant for editing workflow states.

Namespace

Drupal\workflows\Form

Code

protected function actions(array $form, FormStateInterface $form_state) {
    $actions['submit'] = [
        '#type' => 'submit',
        '#value' => $this->t('Save'),
        '#submit' => [
            '::submitForm',
            '::save',
        ],
    ];
    $actions['delete'] = [
        '#type' => 'link',
        '#title' => $this->t('Delete'),
        '#access' => $this->entity
            ->access('delete-state:' . $this->stateId),
        '#attributes' => [
            'class' => [
                'button',
                'button--danger',
            ],
        ],
        '#url' => Url::fromRoute('entity.workflow.delete_state_form', [
            'workflow' => $this->entity
                ->id(),
            'workflow_state' => $this->stateId,
        ]),
    ];
    return $actions;
}

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