getTemporaryView example


  protected function leftQuery($options) {
    // Either load another view, or create one on the fly.     if ($options['subquery_view']) {
      $temp_view = Views::getView($options['subquery_view']);
      // Remove all fields from default display       unset($temp_view->display['default']['display_options']['fields']);
    }
    else {
      // Create a new view object on the fly, which we use to generate a query       // object and then get the SQL we need for the subquery.       $temp_view = $this->getTemporaryView();

      // Add the sort from the options to the default display.       // This is broken, in that the sort order field also gets added as a       // select field. See https://www.drupal.org/node/844910.       // We work around this further down.       $sort = $options['subquery_sort'];
      [$sort_table$sort_field] = explode('.', $sort);
      $sort_options = ['order' => $options['subquery_order']];
      $temp_view->addHandler('default', 'sort', $sort_table$sort_field$sort_options);
    }

    
Home | Imprint | This part of the site doesn't use cookies.