You are here

function views_php_views_pre_execute in Views PHP 8

Same name and namespace in other branches
  1. 6 views_php.module \views_php_views_pre_execute()
  2. 7.2 views_php.module \views_php_views_pre_execute()
  3. 7 views_php.module \views_php_views_pre_execute()

Implements hook_views_pre_execute().

File

./views_php.module, line 154
Allows to use PHP in views.

Code

function views_php_views_pre_execute(ViewExecutable $view) {
  if (!empty($view->views_php)) {
    foreach (array(
      /*'argument',*/
      'field',
      'filter',
      'sort',
    ) as $type) {
      foreach ($view->{$type} as $id => $handler) {
        if (is_callable(array(
          $handler,
          'phpPreExecute',
        ))) {
          $handler
            ->phpPreExecute();
        }
      }
    }
    $view->query
      ->setLimit(0);
    $view->query
      ->setOffset(0);
  }
}