You are here

protected function VariantRouteFilter::checkPageVariantAccess in Page Manager 8

Same name and namespace in other branches
  1. 8.4 src/Routing/VariantRouteFilter.php \Drupal\page_manager\Routing\VariantRouteFilter::checkPageVariantAccess()

Checks access of a page variant.

Parameters

string $page_variant_id: The page variant ID.

Return value

bool TRUE if the route is valid, FALSE otherwise.

1 call to VariantRouteFilter::checkPageVariantAccess()
VariantRouteFilter::getVariantRouteName in src/Routing/VariantRouteFilter.php
Gets the route name of the first valid variant.

File

src/Routing/VariantRouteFilter.php, line 187
Contains \Drupal\page_manager\Routing\VariantRouteFilter.

Class

VariantRouteFilter
Filters variant routes.

Namespace

Drupal\page_manager\Routing

Code

protected function checkPageVariantAccess($page_variant_id) {

  /** @var \Drupal\page_manager\PageVariantInterface $variant */
  $variant = $this->pageVariantStorage
    ->load($page_variant_id);
  try {
    $access = $variant && $variant
      ->access('view');
  } catch (ContextException $e) {
    $access = FALSE;
  }
  return $access;
}