public function SettingsForm::buildForm in GoogleTagManager 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ SettingsForm.php, line 33
Class
- SettingsForm
- Defines the Google tag manager module and default container settings form.
Namespace
Drupal\google_tag\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$this->container = $this
->config('google_tag.settings');
$this->prefix = '_default_container.';
// Build form elements.
$description = $this
->t('<br />After configuring the module settings and default properties for a new container, <strong>add a container</strong> on the <a href=":url">container management page</a>.', [
':url' => Url::fromRoute('entity.google_tag_container.collection')
->toString(),
]);
$form['instruction'] = [
'#type' => 'markup',
'#markup' => $description,
];
$form['module'] = $this
->moduleFieldset($form_state);
$form['settings'] = [
'#type' => 'vertical_tabs',
'#title' => $this
->t('Default container settings'),
'#description' => $this
->t('The default container settings that apply to a new container.'),
'#attributes' => [
'class' => [
'google-tag',
],
],
];
$form['conditions'] = [
'#type' => 'vertical_tabs',
'#title' => $this
->t('Default insertion conditions'),
'#description' => $this
->t('The default snippet insertion conditions that apply to a new container.'),
'#attributes' => [
'class' => [
'google-tag',
],
],
'#attached' => [
'library' => [
'google_tag/drupal.settings_form',
],
],
];
$form['advanced'] = $this
->advancedFieldset($form_state);
$form['path'] = $this
->pathFieldset($form_state);
$form['role'] = $this
->roleFieldset($form_state);
$form['status'] = $this
->statusFieldset($form_state);
return parent::buildForm($form, $form_state);
}