public function CommerceAutoSkuPermissionController::autoSkuPermissions in Commerce AutoSKU 8.2
Returns an array of commerce_autosku permissions
Return value
array
1 string reference to 'CommerceAutoSkuPermissionController::autoSkuPermissions'
File
- src/
CommerceAutoSkuPermissionController.php, line 52 - Contains \Drupal\commerce_autosku\AutoEntityLabelPermissionController.
Class
- CommerceAutoSkuPermissionController
- Provides dynamic permissions of the commerce_autosku module.
Namespace
Drupal\commerce_autoskuCode
public function autoSkuPermissions() {
$permissions = [];
foreach ($this->entityManager
->getDefinitions() as $entity_type_id => $entity_type) {
// Create a permission for each entity type to manage the entity
// labels.
if ($entity_type
->hasLinkTemplate('auto-sku') && $entity_type
->hasKey('label')) {
$permissions['administer ' . $entity_type_id . ' SKU'] = [
'title' => $this
->t('%entity_label: Administer automatic SKU', [
'%entity_label' => $entity_type
->getLabel(),
]),
'restrict access' => TRUE,
];
}
}
return $permissions;
}