You are here

public function FeatureListMenuLink::access in Configuration selector 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Derivative/FeatureListMenuLink.php \Drupal\config_selector\Plugin\Derivative\FeatureListMenuLink::access()

Allows access to Config Selector UI if there are entities.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

1 string reference to 'FeatureListMenuLink::access'
config_selector.routing.yml in ./config_selector.routing.yml
config_selector.routing.yml

File

src/Plugin/Derivative/FeatureListMenuLink.php, line 59

Class

FeatureListMenuLink
Test derivative with an unsafe string.

Namespace

Drupal\config_selector\Plugin\Derivative

Code

public function access() {
  $entity_type = $this->entityTypeManager
    ->getDefinition('config_selector_feature');
  return AccessResult::allowedIf($this
    ->count() > 0)
    ->addCacheTags($entity_type
    ->getListCacheTags())
    ->addCacheContexts($entity_type
    ->getListCacheContexts());
}