You are here

function ldap_query_entity_operation in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_query/ldap_query.module \ldap_query_entity_operation()

Implements hook_entity_operation().

File

ldap_query/ldap_query.module, line 30
Module file for ldap_query.

Code

function ldap_query_entity_operation(EntityInterface $entity) {
  $operations = [];
  if (\Drupal::currentUser()
    ->hasPermission('administer ldap')) {
    if ($entity
      ->getEntityType()
      ->id() == 'ldap_query_entity') {
      $operations['query_test'] = [
        'title' => t('Test'),
        'weight' => 10,
        'url' => $entity
          ->toUrl('test'),
      ];
    }
  }
  return $operations;
}