You are here

function rng_entity_operation in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 8 rng.module \rng_entity_operation()
  2. 3.x rng.module \rng_entity_operation()

Implements hook_entity_operation().

File

./rng.module, line 58

Code

function rng_entity_operation(EntityInterface $entity) {
  $operations = [];
  if ($entity instanceof EventTypeInterface) {
    $operations['access_defaults'] = [
      'title' => t('Event access defaults'),
      'url' => Url::fromRoute('entity.rng_event_type.access_defaults', [
        'rng_event_type' => $entity
          ->id(),
      ]),
      'weight' => 20,
    ];
    $operations['default_messages'] = [
      'title' => t('Default messages'),
      'url' => Url::fromRoute('entity.rng_event_type.default_messages', [
        'rng_event_type' => $entity
          ->id(),
      ]),
      'weight' => 25,
    ];
  }
  return $operations;
}