From dd030937c404e72d080c36e5b7d2a9907c181ddf Mon Sep 17 00:00:00 2001 From: Simon Peacock Date: Thu, 23 Sep 2021 18:01:04 +0100 Subject: [PATCH] CMS-2193-update-d9 - making d9 compliant --- qubit_lite.info.yml | 2 +- qubit_lite.links.menu.yml | 1 - src/Controller/QubitTrackingController.php | 6 ++++-- src/Form/QubitLiteSettingsForm.php | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/qubit_lite.info.yml b/qubit_lite.info.yml index 81f2080..7222b18 100644 --- a/qubit_lite.info.yml +++ b/qubit_lite.info.yml @@ -1,5 +1,5 @@ name: Qubit Lite type: module description: A small iframe version of the Qubit tracking integration -core: 8.x +core_version_requirement: ^8 || ^9 || ^10 package: Statistics diff --git a/qubit_lite.links.menu.yml b/qubit_lite.links.menu.yml index 9ed68e2..175bd5d 100644 --- a/qubit_lite.links.menu.yml +++ b/qubit_lite.links.menu.yml @@ -4,4 +4,3 @@ qubit_lite.qubit_lite_settings_form: description: 'Settings for Qubit Lite' parent: system.admin_config_system weight: 99 - diff --git a/src/Controller/QubitTrackingController.php b/src/Controller/QubitTrackingController.php index 53dc7b9..56221de 100644 --- a/src/Controller/QubitTrackingController.php +++ b/src/Controller/QubitTrackingController.php @@ -46,7 +46,7 @@ public function setRouterContext(AdminContext $admin_context) { /** * A router callback to generate the tracking page. * - * @return Response + * @return \Drupal\Core\Cache\CacheableResponse\Response * A Symfony response object representing the tracking page. */ public function build() { @@ -99,7 +99,9 @@ public function onCurrentPage() { /** * Load biscotti script if the settings are not empty. + * * @return bool|Response + * Returns a new response. */ public function loadBiscotti() { $config = $this->config('qubit_lite.settings'); @@ -125,7 +127,7 @@ public function loadBiscotti() { } else { $domains = explode(PHP_EOL, $biscotti_safe_domains); - $new_domains = array(); + $new_domains = []; foreach ($domains as $domain) { $trim = trim($domain); $new_domains[] = "'" . $trim . "'"; diff --git a/src/Form/QubitLiteSettingsForm.php b/src/Form/QubitLiteSettingsForm.php index 7b11953..5a44a3d 100644 --- a/src/Form/QubitLiteSettingsForm.php +++ b/src/Form/QubitLiteSettingsForm.php @@ -33,39 +33,39 @@ public function getFormId() { */ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('qubit_lite.settings'); - $form['customer_id'] = array( + $form['customer_id'] = [ '#type' => 'textfield', '#title' => $this->t('Customer Id'), '#default_value' => $config->get('customer_id'), - ); + ]; - $form['site_id'] = array( + $form['site_id'] = [ '#type' => 'textfield', '#title' => $this->t('Site Id'), '#default_value' => $config->get('site_id'), - ); + ]; - $form['biscotti'] = array( + $form['biscotti'] = [ '#type' => 'fieldset', '#title' => $this->t('Biscotti settings'), - ); + ]; - $form['biscotti']['biscotti_url'] = array( + $form['biscotti']['biscotti_url'] = [ '#type' => 'textfield', '#title' => $this->t('Biscotti url'), '#default_value' => $config->get('biscotti_url'), '#size' => 60, '#maxlength' => 128, '#required' => TRUE, - ); + ]; - $form['biscotti']['biscotti_safe_domains'] = array( + $form['biscotti']['biscotti_safe_domains'] = [ '#type' => 'textarea', '#title' => $this->t('Safe domains'), '#default_value' => $config->get('biscotti_safe_domains'), '#description' => $this->t('Add one domain per line'), '#required' => TRUE, - ); + ]; return parent::buildForm($form, $form_state); }