You are here

public function Permissions::editPermissions in Workbench Moderation State Access 8

Returns an array of edit permissions.

Return value

array The edit permissions.

1 string reference to 'Permissions::editPermissions'
workbench_moderation_state_access.permissions.yml in ./workbench_moderation_state_access.permissions.yml
workbench_moderation_state_access.permissions.yml

File

src/Permissions.php, line 21

Class

Permissions
Defines a class for dynamic permissions based on states.

Namespace

Drupal\workbench_moderation_state_access

Code

public function editPermissions() {

  // @todo write a test for this.
  $perms = [];

  /* @var \Drupal\workbench_moderation\ModerationStateInterface $state */
  foreach (ModerationState::loadMultiple() as $id => $state) {
    $perms['edit content in the ' . $id . ' state'] = [
      'title' => $this
        ->t('Edit content when in the %state_name state.', [
        '%state_name' => $state
          ->label(),
      ]),
    ];
  }
  return $perms;
}