You are here

function acb_get_modules in Access Control Bridge 8

Same name and namespace in other branches
  1. 7 acb.module \acb_get_modules()

Returns a list of all active access control modules.

Parameters

bool $self: Boolean indicating if acb itself should be included in the list.

Return value

array An array containing all active access controlling modules.

3 calls to acb_get_modules()
acb_modules_installed in ./acb.module
Implements hook_modules_installed().
acb_node_access_records_alter in ./acb.module
Implements hook_node_access_records_alter().
acb_node_grants_alter in ./acb.module
Implements hook_node_grants_alter().

File

./acb.module, line 36
Drupal hooks and functions for the acb module.

Code

function acb_get_modules($self = FALSE) {
  $modules = array_unique(array_merge(\Drupal::moduleHandler()
    ->getImplementations('node_grants'), \Drupal::moduleHandler()
    ->getImplementations('node_access_records')));

  // Exclude ACL as it doesn't control anything on its own.
  $exclude = [
    'acl',
  ];
  if ($self) {
    $exclude[] = 'acb';
  }

  // Sort the list so the modules are always returned in the same order.
  sort($modules);
  return array_diff($modules, $exclude);
}