Mercurial > hg > isophonics-drupal-site
view core/modules/block_content/src/Access/RefinableDependentAccessTrait.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | |
children |
line wrap: on
line source
<?php namespace Drupal\block_content\Access; use Drupal\Core\Access\AccessibleInterface; /** * Trait for \Drupal\block_content\Access\RefinableDependentAccessInterface. * * @internal */ 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; } }