protected function Panelizer::hasOperationPermission in Panelizer 8.3
Same name and namespace in other branches
- 8.5 src/Panelizer.php \Drupal\panelizer\Panelizer::hasOperationPermission()
- 8.4 src/Panelizer.php \Drupal\panelizer\Panelizer::hasOperationPermission()
Check permission for an individual operation only.
Doesn't check any of the baseline permissions that you need along with the operation permission.
Parameters
string $op: The operation.
string $entity_type_id: The entity type id.
string $bundle: The bundle.
\Drupal\Core\Session\AccountInterface $account: The user account.
Return value
bool TRUE if the user has permission; FALSE otherwise.
2 calls to Panelizer::hasOperationPermission()
- Panelizer::hasDefaultPermission in src/
Panelizer.php - Checks if a user has permission to perform an operation on a default.
- Panelizer::hasEntityPermission in src/
Panelizer.php - Checks if a user has permission to perform an operation on an entity.
File
- src/
Panelizer.php, line 616
Class
- Panelizer
- The Panelizer service.
Namespace
Drupal\panelizerCode
protected function hasOperationPermission($op, $entity_type_id, $bundle, AccountInterface $account) {
switch ($op) {
case 'change content':
return $account
->hasPermission("administer panelizer {$entity_type_id} {$bundle} content");
case 'change layout':
return $account
->hasPermission("administer panelizer {$entity_type_id} {$bundle} layout");
case 'revert to default':
return $account
->hasPermission("administer panelizer {$entity_type_id} {$bundle} revert");
}
return FALSE;
}