Assembles the default display options for the view.
Most wizards will need to override this method to provide some fields or a different row plugin.
array Returns an array of display options.
protected function defaultDisplayOptions() {
$display_options = array();
$display_options['access']['type'] = 'none';
$display_options['cache']['type'] = 'none';
$display_options['query']['type'] = 'views_query';
$display_options['exposed_form']['type'] = 'basic';
$display_options['pager']['type'] = 'full';
$display_options['style']['type'] = 'default';
$display_options['row']['type'] = 'fields';
// Add default options array to each plugin type.
foreach ($display_options as &$options) {
$options['options'] = array();
}
// Add a least one field so the view validates and the user has a preview.
// The base field can provide a default in its base settings; otherwise,
// choose the first field with a field handler.
$data = Views::viewsData()
->get($this->base_table);
if (isset($data['table']['base']['defaults']['field'])) {
$field = $data['table']['base']['defaults']['field'];
}
else {
foreach ($data as $field => $field_data) {
if (isset($field_data['field']['id'])) {
break;
}
}
}
$display_options['fields'][$field] = array(
'table' => $this->base_table,
'field' => $field,
'id' => $field,
);
return $display_options;
}