You are here

function _rac_get_supported_entity_types in Role Access Control 8.2

Same name and namespace in other branches
  1. 8 rac.module \_rac_get_supported_entity_types()

Get entity types which have access controled by rac plugins.

Controlled entity types are defined by Role Access Consumer Plugins. Each plugin provides a list of the entity types it handles access control for.

Return value

array List of entity type ids.

1 call to _rac_get_supported_entity_types()
rac_form_field_storage_config_edit_form_alter in ./rac.module
Implements hook_form_FORM_ID_alter().

File

./rac.module, line 305
Module providing role access relations.

Code

function _rac_get_supported_entity_types() {
  static $supportedTypes = NULL;
  if ($supportedTypes === NULL) {

    // For each consumer get its list of supported entity types.
    $supportedTypes = [];
    $providerManager = \Drupal::service('plugin.manager.adva.consumer');
    foreach ($providerManager
      ->getConsumersForProviderId('rac') as $consumer) {
      $supportedTypes[] = $consumer
        ->getEntityTypeId();
    }
  }
  return array_unique($supportedTypes);
}