trait RefinableDependentAccessTrait
Same name in other branches
- 9 core/modules/block_content/src/Access/RefinableDependentAccessTrait.php \Drupal\block_content\Access\RefinableDependentAccessTrait
- 8.9.x core/modules/block_content/src/Access/RefinableDependentAccessTrait.php \Drupal\block_content\Access\RefinableDependentAccessTrait
- 10 core/modules/block_content/src/Access/RefinableDependentAccessTrait.php \Drupal\block_content\Access\RefinableDependentAccessTrait
Trait for \Drupal\block_content\Access\RefinableDependentAccessInterface.
@internal
Hierarchy
- trait \Drupal\block_content\Access\RefinableDependentAccessTrait
3 files declare their use of RefinableDependentAccessTrait
- BlockContent.php in core/
modules/ block_content/ src/ Entity/ BlockContent.php - DependentAccessTest.php in core/
modules/ block_content/ tests/ src/ Unit/ Access/ DependentAccessTest.php - InlineBlock.php in core/
modules/ layout_builder/ src/ Plugin/ Block/ InlineBlock.php
File
-
core/
modules/ block_content/ src/ Access/ RefinableDependentAccessTrait.php, line 12
Namespace
Drupal\block_content\AccessView source
trait RefinableDependentAccessTrait {
/**
* The access dependency.
*
* @var \Drupal\Core\Access\AccessibleInterface
*/
protected $accessDependency;
/**
* {@inheritdoc}
*/
public function setAccessDependency(AccessibleInterface $access_dependency) {
$this->accessDependency = $access_dependency;
return $this;
}
/**
* {@inheritdoc}
*/
public function getAccessDependency() {
return $this->accessDependency;
}
/**
* {@inheritdoc}
*/
public function addAccessDependency(AccessibleInterface $access_dependency) {
if (empty($this->accessDependency)) {
$this->accessDependency = $access_dependency;
return $this;
}
if (!$this->accessDependency instanceof AccessGroupAnd) {
$accessGroup = new AccessGroupAnd();
$this->accessDependency = $accessGroup->addDependency($this->accessDependency);
}
$this->accessDependency
->addDependency($access_dependency);
return $this;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
RefinableDependentAccessTrait::$accessDependency | protected | property | The access dependency. |
RefinableDependentAccessTrait::addAccessDependency | public | function | |
RefinableDependentAccessTrait::getAccessDependency | public | function | |
RefinableDependentAccessTrait::setAccessDependency | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.