google_analytics_reports_handler_field.inc in Google Analytics Reports 7.3
Definition of google_analytics_reports_handler_field.
File
handlers/google_analytics_reports_handler_field.incView source
<?php
/**
* @file
* Definition of google_analytics_reports_handler_field.
*/
/**
* Provides base field functionality for Google Analytics fields.
*
* @ingroup views_field_handlers
*/
class google_analytics_reports_handler_field extends views_handler_field {
/**
* @var bool
* Stores whether this is a custom field or not.
*/
var $is_custom = NULL;
/**
* {@inheritdoc}
*/
function init(&$view, &$options) {
parent::init($view, $options);
$this->is_custom = google_analytics_reports_is_custom($this->real_field);
}
/**
* {@inheritdoc}
*/
function query() {
if ($this->is_custom) {
$this->real_field = google_analytics_reports_custom_to_variable_field($this->real_field, $this->options['custom_field_number']);
}
parent::query();
}
/**
* {@inheritdoc}
*/
function option_definition() {
$options = parent::option_definition();
if ($this->is_custom) {
$options['custom_field_number'] = array(
'default' => 1,
);
}
return $options;
}
/**
* {@inheritdoc}
*/
function options_form(&$form, &$form_state) {
if ($this->is_custom) {
$form['custom_field_number'] = array(
'#type' => 'textfield',
'#title' => t('Custom field number'),
'#default_value' => isset($this->options['custom_field_number']) ? $this->options['custom_field_number'] : 1,
'#size' => 2,
'#maxlength' => 2,
'#required' => TRUE,
'#element_validate' => array(
'element_validate_integer_positive',
),
);
}
parent::options_form($form, $form_state);
}
}
Classes
Name![]() |
Description |
---|---|
google_analytics_reports_handler_field | Provides base field functionality for Google Analytics fields. |