当前位置: 首页>>代码示例>>PHP>>正文


PHP BlockBase::getCacheContexts方法代码示例

本文整理汇总了PHP中Drupal\Core\Block\BlockBase::getCacheContexts方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockBase::getCacheContexts方法的具体用法?PHP BlockBase::getCacheContexts怎么用?PHP BlockBase::getCacheContexts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Block\BlockBase的用法示例。


在下文中一共展示了BlockBase::getCacheContexts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCacheContexts

 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     // The block by itself doesn't really vary by user, but some of its
     // implementations are (collection module, I'm looking at you). For the sake
     // of semplicity, we add the user context here already.
     $contexts = parent::getCacheContexts();
     return Cache::mergeContexts($contexts, ['user']);
 }
开发者ID:ec-europa,项目名称:joinup-dev,代码行数:11,代码来源:GroupHeaderBlock.php

示例2: getCacheContexts

 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     return Cache::mergeContexts(parent::getCacheContexts(), ['route.book_navigation']);
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:7,代码来源:BookNavigationBlock.php

示例3: getCacheContexts

 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     // ::build() uses MenuLinkTreeInterface::getCurrentRouteMenuTreeParameters()
     // to generate menu tree parameters, and those take the active menu trail
     // into account. Therefore, we must vary the rendered menu by the active
     // trail of the rendered menu.
     // Additional cache contexts, e.g. those that determine link text or
     // accessibility of a menu, will be bubbled automatically.
     $menu_name = $this->getDerivativeId();
     return Cache::mergeContexts(parent::getCacheContexts(), ['route.menu_active_trails:' . $menu_name]);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:14,代码来源:SystemMenuBlock.php

示例4: getCacheContexts

 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     $context = parent::getCacheContexts();
     // The links are only visible for certain roles on certain collections.
     // Normally cache contexts are added automatically but these links depend on
     // an optional context which we manage ourselves.
     return Cache::mergeContexts($context, ['user', 'user.roles', 'collection', 'asset_release', 'solution', 'url.path']);
 }
开发者ID:ec-europa,项目名称:joinup-dev,代码行数:11,代码来源:AddContentBlock.php

示例5: getCacheContexts

 /**
  * Implements \Drupal\Core\Entity\Entity::getCacheContexts().
  */
 public function getCacheContexts()
 {
     return Cache::mergeContexts(parent::getCacheContexts(), array('route'));
 }
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:7,代码来源:FlippyBlock.php

示例6: getCacheContexts

 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     $parent_context = parent::getCacheContexts();
     return Cache::mergeContexts($parent_context, $this->ivwTracker->getCacheContexts());
 }
开发者ID:Cyberschorsch,项目名称:module-ivw_integration,代码行数:8,代码来源:IvwTagBlock.php


注:本文中的Drupal\Core\Block\BlockBase::getCacheContexts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。