google_analytics_reports.install in Google Analytics Reports 8.3
Same filename and directory in other branches
Contains install and update functions for Google Analytics Reports module.
File
google_analytics_reports.installView source
<?php
/**
* @file
* Contains install and update functions for Google Analytics Reports module.
*/
use Drupal\google_analytics_reports\GoogleAnalyticsReports;
/**
* Implements hook_schema().
*/
function google_analytics_reports_schema() {
$schema['google_analytics_reports_fields'] = [
'description' => 'Dimensions and metrics from Google Analytics.',
'fields' => [
'gaid' => [
'description' => 'The primary identifier for a column.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'type' => [
'description' => 'The type of column.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
],
'data_type' => [
'description' => 'The type of data this column represents.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'column_group' => [
'description' => 'The dimensions/metrics group the column belongs to.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'ui_name' => [
'description' => 'The name/label of the column used in user interfaces (UI).',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
],
'description' => [
'description' => 'The full description of the column.',
'type' => 'text',
'size' => 'medium',
],
'calculation' => [
'description' => 'This shows how the metric is calculated. Only available for calculated metrics.',
'type' => 'varchar',
'length' => 128,
],
],
'indexes' => [
'type' => [
'type',
],
],
'unique keys' => [
'gaid' => [
'gaid',
],
],
'primary key' => [
'gaid',
],
];
return $schema;
}
/**
* Implements hook_install().
*/
function google_analytics_reports_install() {
GoogleAnalyticsReports::importFields();
}
/**
* Implements hook_uninstall().
*/
function google_analytics_reports_uninstall() {
drupal_uninstall_schema('google_analytics_reports');
\Drupal::configFactory()
->getEditable('views.view.google_analytics_summary')
->delete();
\Drupal::configFactory()
->getEditable('views.view.google_analytics_reports_page')
->delete();
}
Functions
Name![]() |
Description |
---|---|
google_analytics_reports_install | Implements hook_install(). |
google_analytics_reports_schema | Implements hook_schema(). |
google_analytics_reports_uninstall | Implements hook_uninstall(). |