protected function GroupPermissionsForm::getPermissions in Group 2.0.x
Same name and namespace in other branches
- 8 src/Form/GroupPermissionsForm.php \Drupal\group\Form\GroupPermissionsForm::getPermissions()
Gets the permissions to display in this form.
Return value
array An multidimensional associative array of permissions, keyed by the providing module first and then by permission name.
1 call to GroupPermissionsForm::getPermissions()
- GroupPermissionsForm::buildForm in src/
Form/ GroupPermissionsForm.php - Form constructor.
File
- src/
Form/ GroupPermissionsForm.php, line 101
Class
- GroupPermissionsForm
- Provides the group permissions administration form.
Namespace
Drupal\group\FormCode
protected function getPermissions() {
$by_provider_and_section = [];
// Create a list of group permissions ordered by their provider and section.
foreach ($this->groupPermissionHandler
->getPermissionsByGroupType($this
->getGroupType()) as $permission_name => $permission) {
$by_provider_and_section[$permission['provider']][$permission['section']][$permission_name] = $permission;
}
// Always put the 'General' section at the top if provided.
foreach ($by_provider_and_section as $provider => $sections) {
if (isset($sections['General'])) {
$by_provider_and_section[$provider] = [
'General' => $sections['General'],
] + $sections;
}
}
return $by_provider_and_section;
}