當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ViewExecutable::getCacheTags方法代碼示例

本文整理匯總了PHP中Drupal\views\ViewExecutable::getCacheTags方法的典型用法代碼示例。如果您正苦於以下問題:PHP ViewExecutable::getCacheTags方法的具體用法?PHP ViewExecutable::getCacheTags怎麽用?PHP ViewExecutable::getCacheTags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\views\ViewExecutable的用法示例。


在下文中一共展示了ViewExecutable::getCacheTags方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $rows = !empty($this->view->result) || $this->view->style_plugin->evenEmpty() ? $this->view->style_plugin->render($this->view->result) : array();
     $element = array('#theme' => $this->themeFunctions(), '#view' => $this->view, '#pre_render' => [[$this, 'elementPreRender']], '#rows' => $rows, '#attached' => &$this->view->element['#attached'], '#cache' => &$this->view->element['#cache'], '#post_render_cache' => &$this->view->element['#post_render_cache']);
     if (!isset($element['#cache'])) {
         $element['#cache'] = [];
     }
     $element['#cache'] += ['tags' => []];
     // If the output is a render array, add cache tags, regardless of whether
     // caching is enabled or not; cache tags must always be set.
     $element['#cache']['tags'] = Cache::mergeTags($element['#cache']['tags'], $this->view->getCacheTags());
     return $element;
 }
開發者ID:brstde,項目名稱:gap1,代碼行數:16,代碼來源:DisplayPluginBase.php

示例2: applyDisplayCachablityMetadata

 /**
  * Applies the cacheability of the current display to the given render array.
  *
  * @param array $element
  *   The render array with updated cacheability metadata.
  */
 protected function applyDisplayCachablityMetadata(array &$element)
 {
     /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
     $cache = $this->getPlugin('cache');
     (new CacheableMetadata())->setCacheTags(Cache::mergeTags($this->view->getCacheTags(), isset($this->display['cache_metadata']['tags']) ? $this->display['cache_metadata']['tags'] : []))->setCacheContexts(isset($this->display['cache_metadata']['contexts']) ? $this->display['cache_metadata']['contexts'] : [])->setCacheMaxAge(Cache::mergeMaxAges($cache->getCacheMaxAge(), isset($this->display['cache_metadata']['max-age']) ? $this->display['cache_metadata']['max-age'] : Cache::PERMANENT))->merge(CacheableMetadata::createFromRenderArray($element))->applyTo($element);
 }
開發者ID:318io,項目名稱:318-io,代碼行數:12,代碼來源:DisplayPluginBase.php

示例3: calculateXmlCacheTags

 /**
  * {@inheritdoc}
  */
 protected function calculateXmlCacheTags()
 {
     // Pull the tags directly out of the view object.
     return $this->view->getCacheTags();
 }
開發者ID:pulibrary,項目名稱:recap,代碼行數:8,代碼來源:JuiceboxXmlControllerViewsStyle.php


注:本文中的Drupal\views\ViewExecutable::getCacheTags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。