You are here

public function CookiesTextsForm::buildForm in COOKiES Consent Management 1.0.x

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/CookiesTextsForm.php, line 97

Class

CookiesTextsForm
Configure site information settings for this site.

Namespace

Drupal\cookies\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('cookies.texts');
  $form['banner'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Banner texts'),
    '#open' => TRUE,
  ];
  $form['banner']['bannerText'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Banner details'),
    '#default_value' => $config
      ->get('bannerText'),
    '#required' => TRUE,
  ];
  $form['links'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Links'),
    '#open' => TRUE,
  ];
  $form['links']['privacyPolicy'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Privacy policy'),
    '#default_value' => $config
      ->get('privacyPolicy'),
    '#description' => $this
      ->t("Link title for privacy policy link."),
  ];
  $form['links']['privacyUri'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Privacy uri'),
    '#default_value' => $config
      ->get('privacyUri'),
    '#description' => $this
      ->t("Link path (int./ext.) for privacy policy link."),
  ];
  $form['links']['imprint'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Imprint'),
    '#default_value' => $config
      ->get('imprint'),
    '#description' => $this
      ->t("Link title for imprint link."),
  ];
  $form['links']['imprintUri'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Imprint uri'),
    '#default_value' => $config
      ->get('imprintUri'),
    '#description' => $this
      ->t("Link path (int./ext.) for imprint link."),
  ];
  $form['links']['cookieDocs'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Cookie documentation'),
    '#default_value' => $config
      ->get('cookieDocs'),
    '#description' => $this
      ->t("Link text for a cookie documentation page."),
  ];
  $form['links']['cookieDocsUri'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Cookie documentation uri'),
    '#default_value' => $config
      ->get('cookieDocsUri'),
    '#description' => $this
      ->t("URL for a cookie documentation (default: '/cookies/documentation') page where explicitly is described what 3rd-party services and cookies are used. This is required, if you use 'Group consent'. The default cookies documentation is also provided as a block, if you want to attach these information to an existing page."),
  ];
  $form['buttons'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Button texts'),
    '#open' => TRUE,
  ];
  $form['buttons']['denyAll'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Deny all'),
    '#default_value' => $config
      ->get('denyAll'),
    '#description' => $this
      ->t("Button text 'deny all'."),
  ];
  $form['buttons']['acceptAll'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Accept all'),
    '#default_value' => $config
      ->get('acceptAll'),
    '#description' => $this
      ->t("Button text 'accept all'."),
  ];
  $form['buttons']['settings'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Settings'),
    '#default_value' => $config
      ->get('settings'),
    '#description' => $this
      ->t("Button text 'Settings'."),
  ];
  $form['buttons']['saveSettings'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Save Settings'),
    '#default_value' => $config
      ->get('saveSettings'),
    '#description' => $this
      ->t("Button text for save button."),
  ];
  $form['dialog'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Dialog texts'),
    '#open' => TRUE,
  ];
  $form['dialog']['cookieSettings'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Dialog title'),
    '#default_value' => $config
      ->get('cookieSettings'),
    '#required' => TRUE,
  ];
  $form['dialog']['close'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Close'),
    '#default_value' => $config
      ->get('close'),
    '#description' => $this
      ->t("Close button (hover text)."),
  ];
  $form['dialog']['allowed'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Allowed'),
    '#default_value' => $config
      ->get('allowed'),
    '#description' => $this
      ->t("Switch title (hover text)"),
  ];
  $form['dialog']['denied'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('denied'),
    '#default_value' => $config
      ->get('denied'),
    '#description' => $this
      ->t("Switch title (hover text)."),
  ];
  $form['dialog']['requiredCookies'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Required cookies'),
    '#default_value' => $config
      ->get('requiredCookies'),
    '#description' => $this
      ->t("Text for 'required cookies' with grouped consent."),
  ];
  $form['dialog']['readMore'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Read more'),
    '#default_value' => $config
      ->get('readMore'),
    '#description' => $this
      ->t("Read more link text."),
  ];
  $form['dialog']['officialWebsite'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Official website'),
    '#default_value' => $config
      ->get('officialWebsite'),
    '#description' => $this
      ->t("Official website link text."),
  ];
  $form['dialog']['alwaysActive'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Always active'),
    '#default_value' => $config
      ->get('alwaysActive'),
    '#description' => $this
      ->t("Label replaces switch when service is always active."),
  ];
  $form['dialog']['settingsAllServices'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Settings all services'),
    '#default_value' => $config
      ->get('settingsAllServices'),
    '#description' => $this
      ->t("Dialog footer, label for actions."),
  ];
  return parent::buildForm($form, $form_state);
}