protected function GoogleAnalyticsWizard::defaultDisplayOptions in Google Analytics Reports 8.3
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.
Return value
array Returns an array of display options.
Overrides WizardPluginBase::defaultDisplayOptions
File
- src/
Plugin/ views/ wizard/ GoogleAnalyticsWizard.php, line 33
Class
- GoogleAnalyticsWizard
- Tests creating Google Analytics views with the wizard.
Namespace
Drupal\google_analytics_reports\Plugin\views\wizardCode
protected function defaultDisplayOptions() {
$display_options = parent::defaultDisplayOptions();
// Add permission-based access control.
$display_options['access']['type'] = 'perm';
$display_options['access']['options']['perm'] = 'access google analytics reports';
// Remove the default fields, since we are customizing them here.
unset($display_options['fields']);
// Add the title field.
/* Field: Page tracking: Page Title */
$display_options['fields']['pageTitle'] = [
'id' => 'pageTitle',
'table' => 'google_analytics',
'field' => 'pageTitle',
'label' => '',
'element_label_colon' => FALSE,
];
// Remove the default filters, since we are customizing them here.
unset($display_options['filters']);
/* Filter criterion: Google Analytics: Start date of report */
$display_options['filters']['start_date'] = [
'id' => 'start_date',
'plugin_id' => 'google_analytics_date',
'table' => 'google_analytics',
'field' => 'start_date',
'value' => [
'type' => 'offset',
'value' => '-31 day',
],
'group' => 1,
'expose' => [
'operator' => FALSE,
],
];
/* Filter criterion: Google Analytics: End date of report */
$display_options['filters']['end_date'] = [
'id' => 'end_date',
'plugin_id' => 'google_analytics_date',
'table' => 'google_analytics',
'field' => 'end_date',
'value' => [
'type' => 'offset',
'value' => '-1 day',
],
'group' => 1,
'expose' => [
'operator' => FALSE,
],
];
return $display_options;
}