You are here

function ldap_query_entity_operation in Lightweight Directory Access Protocol (LDAP) 8.4

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

Implements hook_entity_operation().

File

ldap_query/ldap_query.module, line 30

Code

function ldap_query_entity_operation(EntityInterface $entity) : array {
  $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;
}