You are here

public function CustomPublishingOptionPermissions::permissions in Custom Publishing Options 8

Get permissions for Custom Publishing Options.

Return value

array Permissions array.

1 string reference to 'CustomPublishingOptionPermissions::permissions'
custom_pub.permissions.yml in ./custom_pub.permissions.yml
custom_pub.permissions.yml

File

src/CustomPublishingOptionPermissions.php, line 44

Class

CustomPublishingOptionPermissions

Namespace

Drupal\custom_pub

Code

public function permissions() {
  $permissions = [];
  foreach ($this->entityTypeManager
    ->getStorage('custom_publishing_option')
    ->loadMultiple() as $machine_name => $publish_option) {
    $permissions += [
      'can set node publish state to ' . $publish_option
        ->id() => [
        'title' => $this
          ->t('Can set node publish state to %type.', [
          '%type' => $publish_option
            ->label(),
        ]),
      ],
    ];
  }
  return $permissions;
}