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


PHP ViewExecutable::buildThemeFunctions方法代码示例

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


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

示例1: renderMoreLink

 /**
  * {@inheritdoc}
  */
 public function renderMoreLink()
 {
     if ($this->isMoreEnabled() && ($this->useMoreAlways() || !empty($this->view->pager) && $this->view->pager->hasMoreRecords())) {
         // If the user has supplied a custom "More" link path, replace any
         // argument tokens and use that for the URL.
         if ($this->getOption('link_display') == 'custom_url' && ($override_path = $this->getOption('link_url'))) {
             $tokens = $this->getArgumentsTokens();
             $path = $this->viewsTokenReplace($override_path, $tokens);
             // @todo Views should expect and store a leading /. See:
             //   https://www.drupal.org/node/2423913
             $url = Url::fromUserInput('/' . $path);
         } else {
             $url = $this->view->getUrl(NULL, $this->display['id']);
         }
         // If a URL is available (either from the display or a custom path),
         // render the "More" link.
         if ($url) {
             $url_options = array();
             if (!empty($this->view->exposed_raw_input)) {
                 $url_options['query'] = $this->view->exposed_raw_input;
             }
             $url->setOptions($url_options);
             $theme = $this->view->buildThemeFunctions('views_more');
             return array('#theme' => $theme, '#more_url' => $url->toString(), '#link_text' => String::checkPlain($this->useMoreText()), '#view' => $this->view);
         }
     }
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:30,代码来源:DisplayPluginBase.php

示例2: testBuildThemeFunctions

 /**
  * Tests the buildThemeFunctions() method.
  */
 public function testBuildThemeFunctions()
 {
     $config = array('id' => 'test_view', 'tag' => 'OnE, TWO, and three', 'display' => array('default' => array('id' => 'default', 'display_plugin' => 'default', 'display_title' => 'Default')));
     $storage = new View($config, 'view');
     $user = $this->getMock('Drupal\\Core\\Session\\AccountInterface');
     $view = new ViewExecutable($storage, $user);
     $expected = array('test_hook__test_view', 'test_hook');
     $this->assertEquals($expected, $view->buildThemeFunctions('test_hook'));
     // Add a mock display.
     $display = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')->disableOriginalConstructor()->getMock();
     $display->display = $config['display']['default'];
     $view->display_handler = $display;
     $expected = array('test_hook__test_view__default', 'test_hook__default', 'test_hook__one', 'test_hook__two', 'test_hook__and_three', 'test_hook__test_view', 'test_hook');
     $this->assertEquals($expected, $view->buildThemeFunctions('test_hook'));
     //Change the name of the display plugin and make sure that is in the array.
     $view->display_handler->display['display_plugin'] = 'default2';
     $expected = array('test_hook__test_view__default', 'test_hook__default', 'test_hook__one', 'test_hook__two', 'test_hook__and_three', 'test_hook__test_view__default2', 'test_hook__default2', 'test_hook__test_view', 'test_hook');
     $this->assertEquals($expected, $view->buildThemeFunctions('test_hook'));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:22,代码来源:ViewExecutableUnitTest.php

示例3: renderMoreLink

 /**
  * Render the 'more' link
  */
 public function renderMoreLink()
 {
     if ($this->isMoreEnabled() && ($this->useMoreAlways() || !empty($this->view->pager) && $this->view->pager->hasMoreRecords())) {
         $path = $this->getPath();
         if ($this->getOption('link_display') == 'custom_url' && ($override_path = $this->getOption('link_url'))) {
             $tokens = $this->getArgumentsTokens();
             $path = strtr($override_path, $tokens);
         }
         if ($path) {
             if (empty($override_path)) {
                 $path = $this->view->getUrl(NULL, $path);
             }
             $url_options = array();
             if (!empty($this->view->exposed_raw_input)) {
                 $url_options['query'] = $this->view->exposed_raw_input;
             }
             $theme = $this->view->buildThemeFunctions('views_more');
             $path = check_url(url($path, $url_options));
             return array('#theme' => $theme, '#more_url' => $path, '#link_text' => String::checkPlain($this->useMoreText()), '#view' => $this->view);
         }
     }
 }
开发者ID:shumer,项目名称:blog,代码行数:25,代码来源:DisplayPluginBase.php

示例4: themeFunctions

 /**
  * {@inheritdoc}
  */
 public function themeFunctions()
 {
     return $this->view->buildThemeFunctions($this->definition['theme']);
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:7,代码来源:PluginBase.php


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