You are here

protected function MaestroTemplateEditForm::actions in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Form/MaestroTemplateEditForm.php \Drupal\maestro\Form\MaestroTemplateEditForm::actions()

Returns the actions provided by this form.

For the edit form, we only need to change the text of the submit button.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: An associative array containing the current state of the form.

Return value

array An array of supported actions for the current entity form.

Overrides MaestroTemplateFormBase::actions

File

src/Form/MaestroTemplateEditForm.php, line 31

Class

MaestroTemplateEditForm
Class MaestroTemplateEditForm.

Namespace

Drupal\maestro\Form

Code

protected function actions(array $form, FormStateInterface $form_state) {
  $isModal = $this
    ->getRequest()
    ->get('is_modal');
  $actions = parent::actions($form, $form_state);
  $actions['submit']['#value'] = t('Update Template');
  if ($isModal == 'modal') {
    $actions['submit']['#ajax'] = [
      'callback' => [
        $this,
        'save',
      ],
      'wrapper' => '',
    ];
  }
  return $actions;
}