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


PHP View::set方法代码示例

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


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

示例1: initQuery

 /**
  * Do some common building initialization.
  */
 public function initQuery()
 {
     if (!empty($this->query)) {
         $class = get_class($this->query);
         if ($class && $class != 'stdClass') {
             // return if query is already initialized.
             return TRUE;
         }
     }
     // Create and initialize the query object.
     $views_data = Views::viewsData()->get($this->storage->get('base_table'));
     $this->storage->set('base_field', !empty($views_data['table']['base']['field']) ? $views_data['table']['base']['field'] : '');
     if (!empty($views_data['table']['base']['database'])) {
         $this->base_database = $views_data['table']['base']['database'];
     }
     $this->query = $this->display_handler->getPlugin('query');
     return TRUE;
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:21,代码来源:ViewExecutable.php

示例2: testSerialization

 /**
  * Tests serialization of the ViewUI object.
  */
 public function testSerialization()
 {
     // Set a container so the DependencySerializationTrait has it.
     $container = new ContainerBuilder();
     \Drupal::setContainer($container);
     $storage = new View([], 'view');
     $executable = $this->getMockBuilder('Drupal\\views\\ViewExecutable')->disableOriginalConstructor()->setConstructorArgs([$storage])->getMock();
     $storage->set('executable', $executable);
     $view_ui = new ViewUI($storage);
     // Make sure the executable is returned before serializing.
     $this->assertInstanceOf('Drupal\\views\\ViewExecutable', $view_ui->getExecutable());
     $serialized = serialize($view_ui);
     // Make sure the ViewExecutable class is not found in the serialized string.
     $this->assertSame(strpos($serialized, '"Drupal\\views\\ViewExecutable"'), FALSE);
     $unserialized = unserialize($serialized);
     $this->assertInstanceOf('Drupal\\views_ui\\ViewUI', $unserialized);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:20,代码来源:ViewUIObjectTest.php


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