/**
  * Checks if the user has access to underlying storage for a Panels display.
  *
  * @param \Symfony\Component\Routing\Route $route
  *   The route to check against.
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *   The parametrized route.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account)
 {
     $panels_storage_type = $route_match->getParameter('panels_storage_type');
     $panels_storage_id = $route_match->getParameter('panels_storage_id');
     $op = $route->getRequirement('_panels_storage_access');
     return $this->panelsStorage->access($panels_storage_type, $panels_storage_id, $op, $account);
 }
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = array();
     $breadcrumb[] = $this->l($this->t('Home'), '<front>');
     $entity = $this->entityManager->getStorage($route_match->getParameter('entity_type'))->load($route_match->getParameter('entity_id'));
     $breadcrumb[] = \Drupal::linkGenerator()->generateFromUrl($entity->label(), $entity->urlInfo());
     return $breadcrumb;
 }
 /**
  * @inheritdoc
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = new Breadcrumb();
     $geocoder = $route_match->getParameter('service');
     $current_route = $route_match->getRouteName();
     $links = [Link::createFromRoute($this->t('Home'), '<front>'), Link::createFromRoute($this->t('Administration'), 'system.admin'), Link::createFromRoute($this->t('Configuration'), 'system.admin_config'), Link::createFromRoute($this->t('Dmaps'), 'dmaps.settings'), Link::createFromRoute($this->t('Geocoding'), 'dmaps.locations.geocoding_options'), Link::createFromRoute($this->t('Geocoding %service', ['%service' => $geocoder]), $current_route, ['iso' => $route_match->getParameter('iso'), 'service' => $geocoder])];
     $breadcrumb->setLinks($links);
     return $breadcrumb;
 }
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $route_name = $route_match->getRouteName();
     if ($route_name == 'node.view' && $route_match->getParameter('node') && isset($route_match->getParameter('node')->taxonomy_catalog)) {
         return $this->catalogBreadcrumb($route_match->getParameter('node'));
     } elseif (substr($route_name, 0, 16) == 'view.uc_catalog.' && $route_match->getParameter('arg_term_node_tid_depth')) {
         return $this->catalogTermBreadcrumb($route_match->getParameter('arg_term_node_tid_depth'));
     }
 }
Beispiel #5
0
 /**
  * @covers ::getParameter
  * @covers \Drupal\Core\Routing\RouteMatch::getParameterNames
  * @dataProvider routeMatchProvider
  */
 public function testGetParameter(RouteMatchInterface $route_match, Route $route, $parameters, $expected_filtered_parameters)
 {
     foreach ($expected_filtered_parameters as $name => $expected_value) {
         $this->assertSame($expected_value, $route_match->getParameter($name));
     }
     foreach (array_diff_key($parameters, $expected_filtered_parameters) as $name) {
         $this->assertNull($route_match->getParameter($name));
     }
 }
 /**
  * Adds the route name as a cache tag to all cacheable responses.
  *
  * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
  *   The event to process.
  */
 public function onResponse(FilterResponseEvent $event)
 {
     $response = $event->getResponse();
     if ($response instanceof CacheableResponseInterface) {
         $cacheability_metadata = $response->getCacheableMetadata();
         // If the route specifies a 'base route name', use that. Otherwise fall
         // back to the route name. The 'base route name' is specified in
         // \Drupal\page_manager\Routing\PageManagerRoutes.
         $route_name = $this->routeMatch->getParameter('base_route_name') ?: $this->routeMatch->getRouteName();
         $cacheability_metadata->addCacheTags(['page_manager_route_name:' . $route_name]);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getTitle()
 {
     $route = $this->routeProvider->getRouteByName($this->getRouteName());
     $param = $route->getDefault('event');
     if ($event = $this->currentRoute->getParameter($param)) {
         if ($this->eventManager->getMeta($event)->isDefaultRules('rng_event.register')) {
             return $this->t('Customize access rules');
         } else {
             return $this->t('Reset access rules to site default');
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = [Link::createFromRoute($this->t('Home'), '<front>')];
     $entity = $route_match->getParameter('entity');
     $breadcrumb[] = new Link($entity->label(), $entity->urlInfo());
     if (($pid = $route_match->getParameter('pid')) && ($comment = $this->storage->load($pid))) {
         /** @var \Drupal\comment\CommentInterface $comment */
         // Display link to parent comment.
         // @todo Clean-up permalink in https://www.drupal.org/node/2198041
         $breadcrumb[] = new Link($comment->getSubject(), $comment->urlInfo());
     }
     return $breadcrumb;
 }
Beispiel #9
0
 /**
  * {@inheritdoc}
  */
 public function getArgument()
 {
     // If there is a user object in the current route.
     if ($user = $this->routeMatch->getParameter('user')) {
         if ($user instanceof UserInterface) {
             return $user->id();
         }
     }
     // If option to use node author; and node in current route.
     if (!empty($this->options['user']) && ($node = $this->routeMatch->getParameter('node'))) {
         if ($node instanceof NodeInterface) {
             return $node->getOwnerId();
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function determineBlockContext()
 {
     if (($route_object = $this->routeMatch->getRouteObject()) && ($route_contexts = $route_object->getOption('parameters')) && isset($route_contexts['node'])) {
         $context = new Context(new ContextDefinition($route_contexts['node']['type']));
         if ($node = $this->routeMatch->getParameter('node')) {
             $context->setContextValue($node);
         }
         $this->addContext('node', $context);
     } elseif ($this->routeMatch->getRouteName() == 'node.add') {
         $node_type = $this->routeMatch->getParameter('node_type');
         $context = new Context(new ContextDefinition('entity:node'));
         $context->setContextValue(Node::create(array('type' => $node_type->id())));
         $this->addContext('node', $context);
     }
 }
  /**
   * Performs an operation on the currency entity.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $routeMatch
   *   The route match.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   A redirect back to the currency listing.
   */
  public function performOperation(RouteMatchInterface $routeMatch) {
    $currency = $routeMatch->getParameter('commerce_currency');
    $op = $routeMatch->getParameter('op');
    $currency->$op()->save();

    if ($op == 'enable') {
      drupal_set_message($this->t('The %label currency has been enabled.', ['%label' => $currency->label()]));
    }
    elseif ($op == 'disable') {
      drupal_set_message($this->t('The %label currency has been disabled.', ['%label' => $currency->label()]));
    }

    $url = $currency->urlInfo('collection');
    return $this->redirect($url->getRouteName(), $url->getRouteParameters(), $url->getOptions());
  }
Beispiel #12
0
 /**
  * Handler a response for a given view and display.
  *
  * @param string $view_id
  *   The ID of the view
  * @param string $display_id
  *   The ID of the display.
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *   The route match.
  * @return null|void
  */
 public function handle($view_id, $display_id, RouteMatchInterface $route_match)
 {
     $args = array();
     $route = $route_match->getRouteObject();
     $map = $route->hasOption('_view_argument_map') ? $route->getOption('_view_argument_map') : array();
     foreach ($map as $attribute => $parameter_name) {
         // Allow parameters be pulled from the request.
         // The map stores the actual name of the parameter in the request. Views
         // which override existing controller, use for example 'node' instead of
         // arg_nid as name.
         if (isset($map[$attribute])) {
             $attribute = $map[$attribute];
         }
         if ($arg = $route_match->getRawParameter($attribute)) {
         } else {
             $arg = $route_match->getParameter($attribute);
         }
         if (isset($arg)) {
             $args[] = $arg;
         }
     }
     /** @var \Drupal\views\Plugin\views\display\DisplayPluginBase $class */
     $class = $route->getOption('_view_display_plugin_class');
     if ($route->getOption('returns_response')) {
         /** @var \Drupal\views\Plugin\views\display\ResponseDisplayPluginInterface $class */
         return $class::buildResponse($view_id, $display_id, $args);
     } else {
         $build = $class::buildBasicRenderable($view_id, $display_id, $args, $route);
         Page::setPageRenderArray($build);
         return $build;
     }
 }
 /**
  * Checks access to the translation overview for the entity and bundle.
  *
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *   The parametrized route.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  * @param string $entity_type_id
  *   The entity type ID.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access(RouteMatchInterface $route_match, AccountInterface $account, $entity_type_id)
 {
     /* @var \Drupal\Core\Entity\ContentEntityInterface $entity */
     $entity = $route_match->getParameter($entity_type_id);
     if ($entity && $entity->isTranslatable()) {
         // Get entity base info.
         $bundle = $entity->bundle();
         // Get entity access callback.
         $definition = $this->entityManager->getDefinition($entity_type_id);
         $translation = $definition->get('translation');
         $access_callback = $translation['content_translation']['access_callback'];
         $access = call_user_func($access_callback, $entity);
         if ($access->isAllowed()) {
             return $access;
         }
         // Check "translate any entity" permission.
         if ($account->hasPermission('translate any entity')) {
             return AccessResult::allowed()->cachePerPermissions()->inheritCacheability($access);
         }
         // Check per entity permission.
         $permission = "translate {$entity_type_id}";
         if ($definition->getPermissionGranularity() == 'bundle') {
             $permission = "translate {$bundle} {$entity_type_id}";
         }
         return AccessResult::allowedIfHasPermission($account, $permission)->inheritCacheability($access);
     }
     // No opinion.
     return AccessResult::neutral();
 }
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $book_nids = array();
     $breadcrumb = new Breadcrumb();
     $links = array(Link::createFromRoute($this->t('Home'), '<front>'));
     $book = $route_match->getParameter('node')->book;
     $depth = 1;
     // We skip the current node.
     while (!empty($book['p' . ($depth + 1)])) {
         $book_nids[] = $book['p' . $depth];
         $depth++;
     }
     $parent_books = $this->nodeStorage->loadMultiple($book_nids);
     if (count($parent_books) > 0) {
         $depth = 1;
         while (!empty($book['p' . ($depth + 1)])) {
             if (!empty($parent_books[$book['p' . $depth]]) && ($parent_book = $parent_books[$book['p' . $depth]])) {
                 $access = $parent_book->access('view', $this->account, TRUE);
                 $breadcrumb->addCacheableDependency($access);
                 if ($access->isAllowed()) {
                     $breadcrumb->addCacheableDependency($parent_book);
                     $links[] = Link::createFromRoute($parent_book->label(), 'entity.node.canonical', array('node' => $parent_book->id()));
                 }
             }
             $depth++;
         }
     }
     $breadcrumb->setLinks($links);
     $breadcrumb->addCacheContexts(['route.book_navigation']);
     return $breadcrumb;
 }
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = new Breadcrumb();
     $breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
     $term = $route_match->getParameter('taxonomy_term');
     // Breadcrumb needs to have terms cacheable metadata as a cacheable
     // dependency even though it is not shown in the breadcrumb because e.g. its
     // parent might have changed.
     $breadcrumb->addCacheableDependency($term);
     // @todo This overrides any other possible breadcrumb and is a pure
     //   hard-coded presumption. Make this behavior configurable per
     //   vocabulary or term.
     $parents = $this->termStorage->loadAllParents($term->id());
     // Remove current term being accessed.
     array_shift($parents);
     foreach (array_reverse($parents) as $term) {
         $term = $this->entityManager->getTranslationFromContext($term);
         $breadcrumb->addCacheableDependency($term);
         $breadcrumb->addLink(Link::createFromRoute($term->getName(), 'entity.taxonomy_term.canonical', array('taxonomy_term' => $term->id())));
     }
     // This breadcrumb builder is based on a route parameter, and hence it
     // depends on the 'route' cache context.
     $breadcrumb->addCacheContexts(['route']);
     return $breadcrumb;
 }
 /**
  * Checks translation access for the entity and operation on the given route.
  *
  * @param \Symfony\Component\Routing\Route $route
  *   The route to check against.
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *   The parametrized route.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  * @param string $source
  *   (optional) For a create operation, the language code of the source.
  * @param string $target
  *   (optional) For a create operation, the language code of the translation.
  * @param string $language
  *   (optional) For an update or delete operation, the language code of the
  *   translation being updated or deleted.
  * @param string $entity_type_id
  *   (optional) The entity type ID.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account, $source = NULL, $target = NULL, $language = NULL, $entity_type_id = NULL)
 {
     /* @var \Drupal\Core\Entity\ContentEntityInterface $entity */
     if ($entity = $route_match->getParameter($entity_type_id)) {
         if ($account->hasPermission('translate any entity')) {
             return AccessResult::allowed()->cachePerRole();
         }
         $operation = $route->getRequirement('_access_content_translation_manage');
         /* @var \Drupal\content_translation\ContentTranslationHandlerInterface $handler */
         $handler = $this->entityManager->getHandler($entity->getEntityTypeId(), 'translation');
         // Load translation.
         $translations = $entity->getTranslationLanguages();
         $languages = $this->languageManager->getLanguages();
         switch ($operation) {
             case 'create':
                 $source_language = $this->languageManager->getLanguage($source) ?: $entity->language();
                 $target_language = $this->languageManager->getLanguage($target) ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT);
                 $is_new_translation = $source_language->getId() != $target_language->getId() && isset($languages[$source_language->getId()]) && isset($languages[$target_language->getId()]) && !isset($translations[$target_language->getId()]);
                 return AccessResult::allowedIf($is_new_translation)->cachePerRole()->cacheUntilEntityChanges($entity)->andIf($handler->getTranslationAccess($entity, $operation));
             case 'update':
             case 'delete':
                 $language = $this->languageManager->getLanguage($language) ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT);
                 $has_translation = isset($languages[$language->getId()]) && $language->getId() != $entity->getUntranslated()->language()->getId() && isset($translations[$language->getId()]);
                 return AccessResult::allowedIf($has_translation)->cachePerRole()->cacheUntilEntityChanges($entity)->andIf($handler->getTranslationAccess($entity, $operation));
         }
     }
     // No opinion.
     return AccessResult::neutral();
 }
 /**
  * Displays the 'Edit existing entity_test' form.
  *
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *   The route match object to get entity type from.
  * @param string $entity_type_id
  *   The entity type ID.
  *
  * @return array
  *   The processed form for the edited entity.
  *
  * @see \Drupal\entity_test\Routing\EntityTestRoutes::routes()
  */
 public function testEdit(RouteMatchInterface $route_match, $entity_type_id)
 {
     $entity = $route_match->getParameter($entity_type_id);
     $form = $this->entityFormBuilder()->getForm($entity);
     $form['#title'] = $entity->label();
     return $form;
 }
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $book_nids = array();
     $links = array(Link::createFromRoute($this->t('Home'), '<front>'));
     $book = $route_match->getParameter('node')->book;
     $depth = 1;
     // We skip the current node.
     while (!empty($book['p' . ($depth + 1)])) {
         $book_nids[] = $book['p' . $depth];
         $depth++;
     }
     $parent_books = $this->nodeStorage->loadMultiple($book_nids);
     if (count($parent_books) > 0) {
         $depth = 1;
         while (!empty($book['p' . ($depth + 1)])) {
             if (!empty($parent_books[$book['p' . $depth]]) && ($parent_book = $parent_books[$book['p' . $depth]])) {
                 if ($parent_book->access('view', $this->account)) {
                     $links[] = Link::createFromRoute($parent_book->label(), 'entity.node.canonical', array('node' => $parent_book->id()));
                 }
             }
             $depth++;
         }
     }
     return $links;
 }
 /**
  * {@inheritdoc}
  */
 public function applies(RouteMatchInterface $route_match)
 {
     if ($route_match->getRouteName() == 'diff.revisions_diff') {
         if ($route_match->getParameter('filter') == 'raw-plain') {
             return TRUE;
         }
     }
 }
Beispiel #20
0
 /**
  * Returns the render array for a single entity field.
  *
  * @param string $field_name
  *   The field name.
  * @param string $entity_type
  *   The entity type.
  * @param mixed $id
  *   The ID of the entity to render.
  * @param string $view_mode
  *   (optional) The view mode that should be used to render the entity.
  *
  * @return null|array
  *   A render array for the field or NULL if the value does not exist.
  */
 public function drupalField($field_name, $entity_type, $id = NULL, $view_mode = 'default')
 {
     $entity = $id ? $this->entityTypeManager->getStorage($entity_type)->load($id) : $this->routeMatch->getParameter($entity_type);
     if (isset($entity->{$field_name})) {
         return $entity->{$field_name}->view($view_mode);
     }
     return NULL;
 }
 /**
  * Check if the filter is used for the given filter.
  *
  * @param \Drupal\Core\Routing\RouteMatchInterface $route
  *   The route.
  *
  * @return \Drupal\Core\Access\AccessResult
  *   An access result.
  */
 public function access(RouteMatchInterface $route)
 {
     $filter = $route->getParameter('filter_format');
     if (!$filter || empty($filter->filters()->get('video_embed_wysiwyg')->getConfiguration()['status'])) {
         return AccessResult::forbidden()->addCacheableDependency($filter);
     }
     return AccessResult::allowed()->addCacheableDependency($filter);
 }
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $breadcrumb = array();
     $breadcrumb[] = Link::createFromRoute($this->t('Home'), '<front>');
     $entity = $route_match->getParameter('entity');
     $breadcrumb[] = new Link($entity->label(), $entity->urlInfo());
     return $breadcrumb;
 }
Beispiel #23
0
 /**
  * {@inheritdoc}
  */
 public function getRuntimeContexts(array $unqualified_context_ids)
 {
     $result = [];
     $context = new Context(new ContextDefinition('entity:node', NULL, FALSE));
     if (($route_object = $this->routeMatch->getRouteObject()) && ($route_contexts = $route_object->getOption('parameters')) && isset($route_contexts['node'])) {
         if ($node = $this->routeMatch->getParameter('node')) {
             $context->setContextValue($node);
         }
     } elseif ($this->routeMatch->getRouteName() == 'node.add') {
         $node_type = $this->routeMatch->getParameter('node_type');
         $context->setContextValue(Node::create(array('type' => $node_type->id())));
     }
     $cacheability = new CacheableMetadata();
     $cacheability->setCacheContexts(['route']);
     $context->addCacheableDependency($cacheability);
     $result['node'] = $context;
     return $result;
 }
Beispiel #24
0
  /**
   * Constructs a new Entity Clone form.
   *
   * @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The route match service.
   * @param \Drupal\Core\StringTranslation\TranslationManager $string_translation
   *   The string translation manager.
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   */
  public function __construct(EntityTypeManager $entity_type_manager, RouteMatchInterface $route_match, TranslationManager $string_translation) {
    $this->entityTypeManager = $entity_type_manager;
    $this->stringTranslationManager = $string_translation;

    $parameter_name = $route_match->getRouteObject()->getOption('_entity_clone_entity_type_id');
    $this->entity = $route_match->getParameter($parameter_name);

    $this->entityTypeDefinition = $entity_type_manager->getDefinition($this->entity->getEntityTypeId());
  }
 /**
  * Checks new registrations are permitted on an event.
  */
 public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account, RegistrationTypeInterface $registration_type = NULL)
 {
     if ($event = $route->getDefault('event')) {
         $context = ['event' => $route_match->getParameter($event)];
         $access_control_handler = $this->entityManager->getAccessControlHandler('registration');
         return $access_control_handler->createAccess($registration_type, $account, $context, TRUE);
     }
     return AccessResult::forbidden();
 }
 /**
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *
  * @return \Drupal\Core\Entity\ContentEntityInterface
  *
  * @throws \Exception
  *   Thrown when no entity was found.
  */
 protected function extractEntityFromRouteMatch(RouteMatchInterface $route_match)
 {
     $route = $route_match->getRouteObject();
     $options = $route->getOptions();
     if (isset($options['parameters'])) {
         foreach ($options['parameters'] as $name => $details) {
             if (!empty($details['type']) && strpos($details['type'], 'entity_revision:') !== FALSE) {
                 return $route_match->getParameter($name);
             }
         }
         foreach ($options['parameters'] as $name => $details) {
             if (!empty($details['type']) && strpos($details['type'], 'entity:') !== FALSE) {
                 return $route_match->getParameter($name);
             }
         }
     }
     throw new \Exception('No entity found');
 }
Beispiel #27
0
 /**
  * Prints the loaded structure of the current entity.
  *
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *    A RouteMatch object.
  *
  * @return array
  *    Array of page elements to render.
  */
 public function entityTokens(RouteMatchInterface $route_match)
 {
     $output = [];
     $parameter_name = $route_match->getRouteObject()->getOption('_token_entity_type_id');
     $entity = $route_match->getParameter($parameter_name);
     if ($entity && $entity instanceof EntityInterface) {
         $output = $this->renderTokenTree($entity);
     }
     return $output;
 }
 /**
  * Checks that an entity is an event type.
  */
 public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account)
 {
     if ($event = $route->getDefault('event')) {
         $event = $route_match->getParameter($event);
         if ($event instanceof EntityInterface) {
             return AccessResult::allowedIf($this->eventManager->isEvent($event));
         }
     }
     return AccessResult::neutral();
 }
 /**
  * Returns the default revision of the entity this route is for.
  *
  * @param \Symfony\Component\Routing\Route $route
  *   The route to check against.
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *   The parametrized route.
  *
  * @return \Drupal\Core\Entity\ContentEntityInterface
  *   returns the Entity in question.
  *
  * @throws \Exception
  *   A generic exception is thrown if the entity couldn't be loaded. This
  *   almost always implies a developer error, so it should get turned into
  *   an HTTP 500.
  */
 protected function loadEntity(Route $route, RouteMatchInterface $route_match)
 {
     $entity_type = $route->getOption('_content_moderation_entity_type');
     if ($entity = $route_match->getParameter($entity_type)) {
         if ($entity instanceof EntityInterface) {
             return $entity;
         }
     }
     throw new \Exception(sprintf('%s is not a valid entity route. The LatestRevisionCheck access checker may only be used with a route that has a single entity parameter.', $route_match->getRouteName()));
 }
 /**
  * {@inheritdoc}
  */
 public function getRuntimeContexts(array $unqualified_context_ids)
 {
     $result = [];
     $context_definition = new ContextDefinition('entity:rdf_entity:asset_release', NULL, FALSE);
     $value = NULL;
     if (($route_object = $this->routeMatch->getRouteObject()) && ($route_contexts = $route_object->getOption('parameters')) && isset($route_contexts['rdf_entity'])) {
         /** @var \Drupal\rdf_entity\RdfInterface $asset_release */
         if ($asset_release = $this->routeMatch->getParameter('rdf_entity')) {
             if ($asset_release->bundle() == 'asset_release') {
                 $value = $asset_release;
             }
         }
     }
     $cacheability = new CacheableMetadata();
     $cacheability->setCacheContexts(['route']);
     $context = new Context($context_definition, $value);
     $context->addCacheableDependency($cacheability);
     $result['asset_release'] = $context;
     return $result;
 }