protected function ContactPermissions::buildPermissions in RedHen CRM 8
Builds a standard list of permissions for a given contact type.
Parameters
\Drupal\redhen_contact\Entity\ContactType $contact_type: The machine name of the contact type.
Return value
array An array of permission names and descriptions.
1 call to ContactPermissions::buildPermissions()
- ContactPermissions::ContactTypePermissions in modules/
redhen_contact/ src/ ContactPermissions.php  - Returns an array of RedHen contact type permissions.
 
File
- modules/
redhen_contact/ src/ ContactPermissions.php, line 37  
Class
Namespace
Drupal\redhen_contactCode
protected function buildPermissions(ContactType $contact_type) {
  $type_id = $contact_type
    ->id();
  $type_params = [
    '%type' => $contact_type
      ->label(),
  ];
  return [
    "add {$type_id} contact" => [
      'title' => $this
        ->t('%type: Add contact', $type_params),
    ],
    "view active {$type_id} contact" => [
      'title' => $this
        ->t('%type: View active contacts', $type_params),
    ],
    "view inactive {$type_id} contact" => [
      'title' => $this
        ->t('%type: View inactive contacts', $type_params),
    ],
    "view own {$type_id} contact" => [
      'title' => $this
        ->t('%type: View own (active) contact', $type_params),
    ],
    "edit own {$type_id} contact" => [
      'title' => $this
        ->t('%type: Edit own contact', $type_params),
    ],
    "edit any {$type_id} contact" => [
      'title' => $this
        ->t('%type: Edit any contact', $type_params),
    ],
    "delete own {$type_id} contact" => [
      'title' => $this
        ->t('%type: Delete own contact', $type_params),
    ],
    "delete any {$type_id} contact" => [
      'title' => $this
        ->t('%type: Delete any contact', $type_params),
    ],
  ];
}