You are here

RouteNameCacheContext.php in Zircon Profile 8.0

Same filename and directory in other branches
  1. 8 core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php

File

core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Core\Cache\Context\RouteNameCacheContext.
 */
namespace Drupal\Core\Cache\Context;


/**
 * Defines the RouteCacheContext service, for "per route name" caching.
 *
 * Cache context ID: 'route.name'.
 */
class RouteNameCacheContext extends RouteCacheContext {

  /**
   * {@inheritdoc}
   */
  public static function getLabel() {
    return t('Route name');
  }

  /**
   * {@inheritdoc}
   */
  public function getContext() {
    return $this->routeMatch
      ->getRouteName();
  }

}

Classes

Namesort descending Description
RouteNameCacheContext Defines the RouteCacheContext service, for "per route name" caching.