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


PHP Views::getview方法代码示例

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


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

示例1: assertCacheTagsForEntityBasedView

 /**
  * Tests cache tags on output & result cache items for an entity-based view.
  */
 protected function assertCacheTagsForEntityBasedView($do_assert_views_caches)
 {
     $this->pass('Checking cache tags for entity-based view.');
     $view = Views::getview('entity_test_row');
     // Empty result (no entities yet).
     $base_tags = $base_render_tags = ['config:views.view.entity_test_row', 'entity_test_list'];
     $this->assertViewsCacheTags($view, $base_tags, $do_assert_views_caches, $base_tags);
     $this->assertViewsCacheTagsFromStaticRenderArray($view, $base_tags, $do_assert_views_caches);
     // Non-empty result (1 entity).
     $entities[] = $entity = EntityTest::create();
     $entity->save();
     $result_tags_with_entity = Cache::mergeTags($base_tags, $entities[0]->getCacheTags());
     $render_tags_with_entity = Cache::mergeTags($base_render_tags, $entities[0]->getCacheTags());
     $render_tags_with_entity = Cache::mergeTags($render_tags_with_entity, ['entity_test_view']);
     $this->assertViewsCacheTags($view, $result_tags_with_entity, $do_assert_views_caches, $render_tags_with_entity);
     $this->assertViewsCacheTagsFromStaticRenderArray($view, $render_tags_with_entity, $do_assert_views_caches);
     // Paged result (more entities than the items-per-page limit).
     for ($i = 0; $i < 5; $i++) {
         $entities[] = $entity = EntityTest::create();
         $entity->save();
     }
     $new_entities_cache_tags = Cache::mergeTags($entities[1]->getCacheTags(), $entities[2]->getCacheTags());
     $new_entities_cache_tags = Cache::mergeTags($new_entities_cache_tags, $entities[3]->getCacheTags());
     $new_entities_cache_tags = Cache::mergeTags($new_entities_cache_tags, $entities[4]->getCacheTags());
     $new_entities_cache_tags = Cache::mergeTags($new_entities_cache_tags, $entities[5]->getCacheTags());
     $result_tags_page_1 = Cache::mergeTags($base_tags, $new_entities_cache_tags);
     $render_tags_page_1 = Cache::mergeTags($base_render_tags, $new_entities_cache_tags);
     $render_tags_page_1 = Cache::mergeTags($render_tags_page_1, ['entity_test_view']);
     $this->assertViewsCacheTags($view, $result_tags_page_1, $do_assert_views_caches, $render_tags_page_1);
     $this->assertViewsCacheTagsFromStaticRenderArray($view, $render_tags_page_1, $do_assert_views_caches);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:34,代码来源:RenderCacheIntegrationTest.php


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