class DefaultAccess in Panelizer 8.3
Same name and namespace in other branches
- 8.5 src/Access/DefaultAccess.php \Drupal\panelizer\Access\DefaultAccess
- 8.4 src/Access/DefaultAccess.php \Drupal\panelizer\Access\DefaultAccess
Hierarchy
- class \Drupal\panelizer\Access\DefaultAccess implements AccessInterface
Expanded class hierarchy of DefaultAccess
1 string reference to 'DefaultAccess'
1 service uses DefaultAccess
File
- src/
Access/ DefaultAccess.php, line 12
Namespace
Drupal\panelizer\AccessView source
class DefaultAccess implements AccessInterface {
/**
* The Panelizer service.
*
* @var \Drupal\panelizer\PanelizerInterface
*/
protected $panelizer;
/**
* DefaultAccess constructor.
*
* @param \Drupal\panelizer\PanelizerInterface $panelizer
* The Panelizer service.
*/
public function __construct(PanelizerInterface $panelizer) {
$this->panelizer = $panelizer;
}
/**
* Determines access to a default Panelizer layout.
*
* @param string $entity_type_id
* The panelized entity type ID.
* @param string $bundle
* The panelized bundle ID.
* @param string $view_mode_name
* The panelized view mode ID.
*
* @return \Drupal\Core\Access\AccessResult
*/
public function access($entity_type_id, $bundle, $view_mode_name) {
$settings = $this->panelizer
->getPanelizerSettings($entity_type_id, $bundle, $view_mode_name);
return $settings['enable'] ? AccessResult::allowed() : AccessResult::forbidden();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultAccess:: |
protected | property | The Panelizer service. | |
DefaultAccess:: |
public | function | Determines access to a default Panelizer layout. | |
DefaultAccess:: |
public | function | DefaultAccess constructor. |