You are here

protected function EventTypeAccessDefaultsForm::actions in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Form/EventTypeAccessDefaultsForm.php \Drupal\rng\Form\EventTypeAccessDefaultsForm::actions()
  2. 8 src/Form/EventTypeAccessDefaultsForm.php \Drupal\rng\Form\EventTypeAccessDefaultsForm::actions()

Remove delete element since it is confusing on non CRUD forms.

Overrides EntityForm::actions

File

src/Form/EventTypeAccessDefaultsForm.php, line 325

Class

EventTypeAccessDefaultsForm
Form for event type access defaults.

Namespace

Drupal\rng\Form

Code

protected function actions(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\rng\Entity\EventTypeInterface $event_type */
  $event_type = $this->entity;
  $actions = parent::actions($form, $form_state);
  unset($actions['delete']);
  $actions['delete-custom-rules'] = [
    '#type' => 'link',
    '#title' => $this
      ->t('Delete all custom rules'),
    '#attributes' => [
      'class' => [
        'button',
        'button--danger',
      ],
    ],
  ];
  $actions['delete-custom-rules']['#url'] = Url::fromRoute('entity.rng_event_type.access_defaults.delete_all', [
    'rng_event_type' => $event_type
      ->id(),
  ]);
  return $actions;
}