Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

RouteNameCacheContext.php

Namespace

Drupal\Core\Cache\Context

File

core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php

View source
<?php

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

Title Deprecated Summary
RouteNameCacheContext Defines the RouteCacheContext service, for "per route name" caching.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal