You are here

protected function EventTypeAccessDefaultsForm::actions in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Form/EventTypeAccessDefaultsForm.php \Drupal\rng\Form\EventTypeAccessDefaultsForm::actions()
  2. 3.x 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 319

Class

EventTypeAccessDefaultsForm
Form for event type access defaults.

Namespace

Drupal\rng\Form

Code

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

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