You are here

protected function WebformEntityAjaxFormTrait::actions in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Form/WebformEntityAjaxFormTrait.php \Drupal\webform\Form\WebformEntityAjaxFormTrait::actions()

File

src/Form/WebformEntityAjaxFormTrait.php, line 81

Class

WebformEntityAjaxFormTrait
Trait class for Webform Ajax support.

Namespace

Drupal\webform\Form

Code

protected function actions(array $form, FormStateInterface $form_state) {
  $actions = parent::actions($form, $form_state);
  if (!$this
    ->getEntity()
    ->isNew() && !$this
    ->isDialogDisabled()) {
    $actions['reset'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Reset'),
      '#submit' => [
        '::noSubmit',
      ],
      '#validate' => [
        '::noSubmit',
      ],
      '#attributes' => [
        'class' => [
          'webform-ajax-refresh',
        ],
      ],
      '#weight' => 100,
    ];
  }
  return $actions;
}