function EntityPermissionsForm::permissionsByProvider
Same name in other branches
- 9 core/modules/user/src/Form/EntityPermissionsForm.php \Drupal\user\Form\EntityPermissionsForm::permissionsByProvider()
- 11.x core/modules/user/src/Form/EntityPermissionsForm.php \Drupal\user\Form\EntityPermissionsForm::permissionsByProvider()
Overrides UserPermissionsForm::permissionsByProvider
1 call to EntityPermissionsForm::permissionsByProvider()
- EntityPermissionsForm::access in core/
modules/ user/ src/ Form/ EntityPermissionsForm.php - Checks that there are permissions to be managed.
File
-
core/
modules/ user/ src/ Form/ EntityPermissionsForm.php, line 92
Class
- EntityPermissionsForm
- Provides the permissions administration form for a bundle.
Namespace
Drupal\user\FormCode
protected function permissionsByProvider() : array {
// Get the names of all config entities that depend on $this->bundle.
$config_name = $this->bundle
->getConfigDependencyName();
$config_entities = $this->configManager
->findConfigEntityDependencies('config', [
$config_name,
]);
$config_names = array_map(fn($dependent_config) => $dependent_config->getConfigDependencyName(), $config_entities);
$config_names[] = $config_name;
// Find all the permissions that depend on $this->bundle.
$permissions = $this->permissionHandler
->getPermissions();
$permissions_by_provider = [];
foreach ($permissions as $permission_name => $permission) {
$required_configs = $permission['dependencies']['config'] ?? [];
if (array_intersect($required_configs, $config_names)) {
$provider = $permission['provider'];
$permissions_by_provider[$provider][$permission_name] = $permission;
}
}
return $permissions_by_provider;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.