public function PanelizerDefaultPanelsStorage::access in Panelizer 8.4
Same name and namespace in other branches
- 8.5 src/Plugin/PanelsStorage/PanelizerDefaultPanelsStorage.php \Drupal\panelizer\Plugin\PanelsStorage\PanelizerDefaultPanelsStorage::access()
- 8.3 src/Plugin/PanelsStorage/PanelizerDefaultPanelsStorage.php \Drupal\panelizer\Plugin\PanelsStorage\PanelizerDefaultPanelsStorage::access()
File
- src/
Plugin/ PanelsStorage/ PanelizerDefaultPanelsStorage.php, line 169
Class
- PanelizerDefaultPanelsStorage
- Panels storage service that stores Panels displays in Panelizer defaults.
Namespace
Drupal\panelizer\Plugin\PanelsStorageCode
public function access($id, $op, AccountInterface $account) {
try {
list($entity_type_id, $bundle, $view_mode, $name) = $this
->parseId($id);
} catch (PanelizerException $e) {
return AccessResult::forbidden();
}
if ($panels_display = $this->panelizer
->getDefaultPanelsDisplay($name, $entity_type_id, $bundle, $view_mode)) {
if ($op == 'change layout') {
if ($this->panelizer
->hasDefaultPermission('change layout', $entity_type_id, $bundle, $view_mode, $name, $account)) {
return AccessResult::allowed();
}
}
else {
if ($op == 'read' || $this->panelizer
->hasDefaultPermission('change content', $entity_type_id, $bundle, $view_mode, $name, $account)) {
return AccessResult::allowed();
}
}
}
return AccessResult::forbidden();
}