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


PHP DisplayPluginBase::isEnabled方法代码示例

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


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

示例1: execute

 /**
  * Execute the view's query.
  *
  * @param string $display_id
  *   The machine name of the display, which should be executed.
  *
  * @return bool
  *   Return whether the executing was successful, for example an argument
  *   could stop the process.
  */
 public function execute($display_id = NULL)
 {
     if (empty($this->built)) {
         if (!$this->build($display_id)) {
             return FALSE;
         }
     }
     if (!empty($this->executed)) {
         return TRUE;
     }
     // Don't allow to use deactivated displays, but display them on the live preview.
     if (!$this->display_handler->isEnabled() && empty($this->live_preview)) {
         $this->build_info['fail'] = TRUE;
         return FALSE;
     }
     // Let modules modify the view just prior to executing it.
     $module_handler = \Drupal::moduleHandler();
     $module_handler->invokeAll('views_pre_execute', array($this));
     // Check for already-cached results.
     if (!empty($this->live_preview)) {
         $cache = $this->display_handler->getPlugin('cache', 'none');
     } else {
         $cache = $this->display_handler->getPlugin('cache');
     }
     if ($cache->cacheGet('results')) {
         if ($this->pager->usePager()) {
             $this->pager->total_items = $this->total_rows;
             $this->pager->updatePageInfo();
         }
     } else {
         $this->query->execute($this);
         // Enforce the array key rule as documented in
         // views_plugin_query::execute().
         $this->result = array_values($this->result);
         $this->_postExecute();
         $cache->cacheSet('results');
     }
     // Let modules modify the view just after executing it.
     $module_handler->invokeAll('views_post_execute', array($this));
     $this->executed = TRUE;
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:51,代码来源:ViewExecutable.php


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