當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。