This did not happen in beta 1 version, but in in beta 2 I cannot change the banner background and text color.

I typed in the hex values (without the #) and clicked on save settings. Nothing to do.

In my recent log messages I get:

Warning: Undefined variable $text_color in Drupal\eu_cookie_compliance\Form\EuCookieComplianceConfigForm->submitForm() (line 1309 from /var/www/vhosts/daproverb.be/httpdocs/modules/eu_cookie_compliance/src/Form/EuCookieComplianceConfigForm.php)
Warning: Undefined variable $bg_color in Drupal\eu_cookie_compliance\Form\EuCookieComplianceConfigForm->submitForm() (line 1308 from /var/www/vhosts/daproverb.be/httpdocs/modules/eu_cookie_compliance/src/Form/EuCookieComplianceConfigForm.php)

I changed back to beta 1 and the problem does not happen.

Please check and fix if possible.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

redseujac created an issue. See original summary.

svenryen’s picture

Can you try to clear cache? I had an issue with the form while developing beta2, but the fields were accessible when I cleared cache. I thought it was just an error on my side, but seems like it needs further work.

We have changed the support library for the color pickers in beta2.

svenryen’s picture

I was able to reproduce. I'll fix this bug tomorrow, sorry for the trouble.

anoopsingh92 made their first commit to this issue’s fork.

svenryen’s picture

Assigned: redseujac » Unassigned
anoopsingh92’s picture

diff --git a/src/Form/EuCookieComplianceConfigForm.php b/src/Form/EuCookieComplianceConfigForm.php
index 451e736..0484b98 100644
--- a/src/Form/EuCookieComplianceConfigForm.php
+++ b/src/Form/EuCookieComplianceConfigForm.php
@@ -1305,8 +1305,8 @@ class EuCookieComplianceConfigForm extends ConfigFormBase {
       ->set('popup_height', $form_state->getValue('popup_height'))
       ->set('popup_width', $form_state->getValue('popup_width'))
       ->set('popup_delay', $form_state->getValue('popup_delay'))
-      ->set('popup_bg_hex', $bg_color)
-      ->set('popup_text_hex', $text_color)
+      ->set('popup_bg_hex', $this->bg_color)
+      ->set('popup_text_hex', $this->text_color)
       ->set('domains_option', $form_state->getValue('domains_option'))
       ->set('domains_list', $form_state->getValue('domains_list'))
       ->set('exclude_paths', $form_state->getValue('exclude_paths'))

Not sure but can we do this?

anoopsingh92’s picture

Checked, This is not a solution. If we will use this then we will get an unused variable error.

-      ->set('popup_bg_hex', $bg_color)
-      ->set('popup_text_hex', $text_color)
+      ->set('popup_bg_hex', $this->bg_color)
+      ->set('popup_text_hex', $this->text_color)
1272 | WARNING | Unused variable $bg_color.
 1273 | WARNING | Unused variable $text_color.

  • svenryen committed 71eb1aa on 8.x-1.x
    Issue #3302278 by svenryen, anoopsingh92: Impossible to change banner...
svenryen’s picture

Status: Active » Fixed

Thanks for the effort @anoopsingh92. Unfortunately it wasn't spot on, so I needed a different approach.
You can see in the merge request how I solved the issue.

And I SHOULD have noticed, as there was a squiggly underline under the two variables in PHPStorm alerting me to the fact that the variables may not have been initialized.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.