protected function ProfilePermissions::buildPermissions in Profile 2 8
Builds a standard list of permissions for a given profile type.
Parameters
\Drupal\profile\Entity\ProfileType $profile_type: The machine name of the profile type.
Return value
array An array of permission names and descriptions.
1 call to ProfilePermissions::buildPermissions()
- ProfilePermissions::profileTypePermissions in src/
ProfilePermissions.php - Returns an array of profile type permissions.
File
- src/
ProfilePermissions.php, line 44 - Contains \Drupal\profile\ProfilePermissions.
Class
- ProfilePermissions
- Defines a class containing permission callbacks.
Namespace
Drupal\profileCode
protected function buildPermissions(ProfileType $profile_type) {
$type_id = $profile_type
->id();
$type_params = array(
'%type' => $profile_type
->label(),
);
return array(
"add own {$type_id} profile" => array(
'title' => $this
->t('%type: Add own profile', $type_params),
),
"add any {$type_id} profile" => array(
'title' => $this
->t('%type: Add any profile', $type_params),
),
"view own {$type_id} profile" => array(
'title' => $this
->t('%type: View own profile', $type_params),
),
"view any {$type_id} profile" => array(
'title' => $this
->t('%type: View any profile', $type_params),
),
"edit own {$type_id} profile" => array(
'title' => $this
->t('%type: Edit own profile', $type_params),
),
"edit any {$type_id} profile" => array(
'title' => $this
->t('%type: Edit any profile', $type_params),
),
"delete own {$type_id} profile" => array(
'title' => $this
->t('%type: Delete own profile', $type_params),
),
"delete any {$type_id} profile" => array(
'title' => $this
->t('%type: Delete any profile', $type_params),
),
);
}