當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。