You are here

public function SchedulerManager::permissionName in Scheduler 2.x

Derives the permission name for an entity type and permission type.

This function is added because for backwards-compatibility the node permission names have to end with 'nodes' and 'content'. For all other newly-supported entity types it is $entityTypeId.

Parameters

string $entityTypeId: The entity type id, for example 'node', 'media' etc.

string $permissionType: The type of permission - 'schedule' or 'view'.

Return value

string The internal name of the scheduler permission.

File

src/SchedulerManager.php, line 1061

Class

SchedulerManager
Defines a scheduler manager.

Namespace

Drupal\scheduler

Code

public function permissionName($entityTypeId, $permissionType) {
  switch ($permissionType) {
    case 'schedule':
      return 'schedule publishing of ' . ($entityTypeId == 'node' ? 'nodes' : $entityTypeId);
    case 'view':
      return 'view scheduled ' . ($entityTypeId == 'node' ? 'content' : $entityTypeId);
  }
}