当前位置: 首页>>代码示例>>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;未经允许,请勿转载。