/** * Executes a view with debugging. * * @param \Drupal\views\ViewExecutable $view * The view object. * @param array $args * (optional) An array of the view arguments to use for the view. */ protected function executeView(ViewExecutable $view, $args = array()) { // A view does not really work outside of a request scope, due to many // dependencies like the current user. $view->setDisplay(); $view->preExecute($args); $view->execute(); $verbose_message = '<pre>Executed view: ' . (string) $view->build_info['query'] . '</pre>'; if ($view->build_info['query'] instanceof SelectInterface) { $verbose_message .= '<pre>Arguments: ' . print_r($view->build_info['query']->getArguments(), TRUE) . '</pre>'; } $this->verbose($verbose_message); }
/** * Executes a view with debugging. * * @param \Drupal\views\ViewExecutable $view * The view object. * @param array $args * (optional) An array of the view arguments to use for the view. */ protected function executeView($view, array $args = array()) { $view->setDisplay(); $view->preExecute($args); $view->execute(); $verbose_message = '<pre>Executed view: ' . (string) $view->build_info['query'] . '</pre>'; if ($view->build_info['query'] instanceof SelectInterface) { $verbose_message .= '<pre>Arguments: ' . print_r($view->build_info['query']->getArguments(), TRUE) . '</pre>'; } $this->verbose($verbose_message); }