You are here

protected function WebformEntityAjaxFormTrait::actions in Webform 6.x

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

File

src/Form/WebformEntityAjaxFormTrait.php, line 81

Class

WebformEntityAjaxFormTrait
Trait for webform entity 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;
}