You are here

protected function Kanban::getCreateEntityPermissions in Content Planner 8

Gets the list of permissions the current user may create a Entity type.

Parameters

\Drupal\content_kanban\EntityTypeConfig[] $entity_type_configs: An array with the entity type configs.

Return value

array Returns an array with the permissions.

1 call to Kanban::getCreateEntityPermissions()
Kanban::build in modules/content_kanban/src/Component/Kanban.php
Build.

File

modules/content_kanban/src/Component/Kanban.php, line 313

Class

Kanban
The main Kanban class.

Namespace

Drupal\content_kanban\Component

Code

protected function getCreateEntityPermissions(array $entity_type_configs) {
  $permissions = [];
  foreach ($entity_type_configs as $entity_type_id => $entity_type_config) {

    // Check if the current user has the permisson to create a certain Entity
    // type.
    if ($this->currentUser
      ->hasPermission("create {$entity_type_id} content")) {
      $permissions[$entity_type_id] = t("Add @type", [
        '@type' => $entity_type_config
          ->getLabel(),
      ]);
    }
  }
  return $permissions;
}