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


PHP ViewExecutable::initPager方法代码示例

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


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

示例1: build

  /**
   * Builds the necessary info to execute the query.
   */
  public function build(ViewExecutable $view) {
    // Make the query distinct if the option was set.
    if (!empty($this->options['distinct'])) {
      $this->setDistinct(TRUE);
    }

    // Store the view in the object to be able to use it later.
    $this->view = $view;

    $view->initPager();

    // Let the pager modify the query to add limits.
    $view->pager->query();

    $view->build_info['query'] = $this->query();
    $view->build_info['count_query'] = $this->query(TRUE);
  }
开发者ID:jthoresen,项目名称:PladsenDrupal,代码行数:20,代码来源:Sql.php

示例2: build

 /**
  * {@inheritdoc}
  */
 public function build(ViewExecutable $view)
 {
     $this->view = $view;
     if ($this->shouldAbort()) {
         return;
     }
     // Setup the nested filter structure for this query.
     if (!empty($this->conditions)) {
         // If the different groups are combined with the OR operator, we have to
         // add a new OR filter to the query to which the filters for the groups
         // will be added.
         if ($this->group_operator === 'OR') {
             $base = $this->query->createConditionGroup('OR');
             $this->query->addConditionGroup($base);
         } else {
             $base = $this->query;
         }
         // Add a nested filter for each filter group, with its set conjunction.
         foreach ($this->conditions as $group_id => $group) {
             if (!empty($group['conditions']) || !empty($group['condition_groups'])) {
                 $group += array('type' => 'AND');
                 // For filters without a group, we want to always add them directly to
                 // the query.
                 $conditions = $group_id === '' ? $this->query : $this->query->createConditionGroup($group['type']);
                 if (!empty($group['conditions'])) {
                     foreach ($group['conditions'] as $condition) {
                         list($field, $value, $operator) = $condition;
                         $conditions->addCondition($field, $value, $operator);
                     }
                 }
                 if (!empty($group['condition_groups'])) {
                     foreach ($group['condition_groups'] as $nested_conditions) {
                         $conditions->addConditionGroup($nested_conditions);
                     }
                 }
                 // If no group was given, the filters were already set on the query.
                 if ($group_id !== '') {
                     $base->addConditionGroup($conditions);
                 }
             }
         }
     }
     // Initialize the pager and let it modify the query to add limits.
     $view->initPager();
     $view->pager->query();
     // Set the search ID, if it was not already set.
     if ($this->query->getOption('search id') == get_class($this->query)) {
         $this->query->setOption('search id', 'search_api_views:' . $view->storage->id() . ':' . $view->current_display);
     }
     // Add the "search_api_bypass_access" option to the query, if desired.
     if (!empty($this->options['bypass_access'])) {
         $this->query->setOption('search_api_bypass_access', TRUE);
     }
     // If the View and the Panel conspire to provide an overridden path then
     // pass that through as the base path.
     if (($path = $this->view->getPath()) && strpos(Url::fromRoute('<current>')->toString(), $this->view->override_path) !== 0) {
         $this->query->setOption('search_api_base_path', $path);
     }
 }
开发者ID:curveagency,项目名称:intranet,代码行数:62,代码来源:SearchApiQuery.php


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