public function AmpAnalyticsService::buildConfigurationForm in Analytics 7
Form constructor.
Parameters
array $form: An associative array containing the initial structure of the plugin form.
array $form_state: The current state of the complete form.
Return value
array The form structure.
Overrides AnalyticsService::buildConfigurationForm
File
- analytics_amp/
src/ AmpAnalyticsService.php, line 21
Class
Code
public function buildConfigurationForm($form, &$form_state) {
$options['type'] = array(
'#title' => t('Type'),
'#type' => 'select',
'#default_value' => $this
->getConfiguration()['type'],
'#options' => array(
// @todo Add support for all options.
'adobeanalytics' => t('Adobe Analytics'),
'googleanalytics' => t('Google Analytics'),
),
'#required' => TRUE,
);
$options['config_url'] = array(
'#title' => t('Remote configuration JSON URL'),
'#type' => 'urlfield',
'#default_value' => $this
->getConfiguration()['config_url'],
'#placeholder' => 'https://example.com/analytics.config.json',
'#element_validate' => array(
'analytics_amp_element_validate_config_url',
),
);
$options['config_json'] = array(
'#title' => t('Inline configuration JSON'),
'#type' => 'textarea',
'#default_value' => json_encode($this
->getConfiguration()['config_json'], JSON_PRETTY_PRINT | JSON_FORCE_OBJECT),
'#element_validate' => array(
'analytics_amp_element_validate_config_json',
),
);
return $options;
}