3 namespace Drupal\Core\Cache\Context;
5 use Drupal\Core\Cache\CacheableMetadata;
8 * Defines the IsSuperUserCacheContext service, for "super user or not" caching.
10 * Cache context ID: 'user.is_super_user'.
12 class IsSuperUserCacheContext extends UserCacheContextBase implements CacheContextInterface {
17 public static function getLabel() {
18 return t('Is super user');
24 public function getContext() {
25 return ((int) $this->user->id()) === 1 ? '1' : '0';
31 public function getCacheableMetadata() {
32 return new CacheableMetadata();