public function RefinableDependentAccessTrait::addAccessDependency in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block_content/src/Access/RefinableDependentAccessTrait.php \Drupal\block_content\Access\RefinableDependentAccessTrait::addAccessDependency()
- 10 core/modules/block_content/src/Access/RefinableDependentAccessTrait.php \Drupal\block_content\Access\RefinableDependentAccessTrait::addAccessDependency()
File
- core/
modules/ block_content/ src/ Access/ RefinableDependentAccessTrait.php, line 39
Class
- RefinableDependentAccessTrait
- Trait for \Drupal\block_content\Access\RefinableDependentAccessInterface.
Namespace
Drupal\block_content\AccessCode
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;
}