Do some common building initialization.
public function initQuery() {
if (!empty($this->query)) {
$class = get_class($this->query);
if ($class && $class != 'stdClass') {
// return if query is already initialized.
return TRUE;
}
}
// Create and initialize the query object.
$views_data = Views::viewsData()
->get($this->storage
->get('base_table'));
$this->storage
->set('base_field', !empty($views_data['table']['base']['field']) ? $views_data['table']['base']['field'] : '');
if (!empty($views_data['table']['base']['database'])) {
$this->base_database = $views_data['table']['base']['database'];
}
$this->query = $this->display_handler
->getPlugin('query');
return TRUE;
}