public function SettingsForm::moduleFieldset in GoogleTagManager 8
Fieldset builder for the module settings form.
1 call to SettingsForm::moduleFieldset()
- SettingsForm::buildForm in src/
Form/ SettingsForm.php - Form constructor.
File
- src/
Form/ SettingsForm.php, line 75
Class
- SettingsForm
- Defines the Google tag manager module and default container settings form.
Namespace
Drupal\google_tag\FormCode
public function moduleFieldset(FormStateInterface $form_state) {
$config = $this
->config('google_tag.settings');
// Build form elements.
$fieldset = [
'#type' => 'fieldset',
'#title' => $this
->t('Module settings'),
'#description' => $this
->t('The settings that apply to all containers.'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
];
$fieldset['uri'] = [
'#type' => 'textfield',
'#title' => $this
->t('Snippet parent URI'),
'#description' => $this
->t('The parent URI for saving snippet files. Snippet files will be saved to "[uri]/google_tag". Enter a plain stream wrapper with a single trailing slash like "public:/".'),
'#default_value' => $config
->get('uri'),
'#attributes' => [
'placeholder' => [
'public:/',
],
],
'#required' => TRUE,
];
$fieldset['compact_snippet'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Compact the JavaScript snippet'),
'#description' => $this
->t('If checked, then the JavaScript snippet will be compacted to remove unnecessary whitespace. This is <strong>recommended on production sites</strong>. Leave unchecked to output a snippet that can be examined using a JavaScript debugger in the browser.'),
'#default_value' => $config
->get('compact_snippet'),
];
$fieldset['include_file'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include the snippet as a file'),
'#description' => $this
->t('If checked, then each JavaScript snippet will be included as a file. This is <strong>recommended</strong>. Leave unchecked to inline each snippet into the page. This only applies to data layer and script snippets.'),
'#default_value' => $config
->get('include_file'),
];
$fieldset['rebuild_snippets'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Recreate snippets on cache rebuild'),
'#description' => $this
->t('If checked, then the JavaScript snippet files will be created during a cache rebuild. This is <strong>recommended on production sites</strong>. If not checked, any missing snippet files will be created during a page response.'),
'#default_value' => $config
->get('rebuild_snippets'),
];
$fieldset['flush_snippets'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Flush snippet directory on cache rebuild'),
'#description' => $this
->t('If checked, then the snippet directory will be deleted during a cache rebuild. If not checked, then manual intervention may be required to tidy up the snippet directory (e.g. remove snippet files for a deleted container).'),
'#default_value' => $config
->get('flush_snippets'),
];
$fieldset['debug_output'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show debug output'),
'#description' => $this
->t('If checked, then the result of each snippet insertion condition will be shown in the message area. Enable <strong>only for development</strong> purposes.'),
'#default_value' => $config
->get('debug_output'),
];
return $fieldset;
}