You are here

function group_content_menu_entity_operation in Group Content Menu 8

Implements hook_entity_operation().

File

./group_content_menu.module, line 55
Provides a group content menu entity type.

Code

function group_content_menu_entity_operation($entity) {
  $operations = [];
  if ($entity
    ->getEntityTypeId() == 'group' && \Drupal::moduleHandler()
    ->moduleExists('views')) {
    if ($entity
      ->hasPermission('access group content menu overview', \Drupal::currentUser())) {
      $operations['menus'] = [
        'title' => t('Menus'),
        'weight' => 20,
        'url' => Url::fromRoute('entity.group_content_menu.collection', [
          'group' => $entity
            ->id(),
        ]),
      ];
    }
  }
  return $operations;
}