Module not working when multilanguage/multidomain project

Created on 20 June 2025, 16 days ago

Problem/Motivation

I installed modul to project as replacement for
https://www.drupal.org/project/eu_cookie_compliance

and it doesnt work.

Page /admin/config/user-interface/klaro
end with error:

The website encountered an unexpected error. Try again later.

TypeError: implode(): Argument #1 ($array) must be of type array, string given in implode() (line 305 of modules/contrib/klaro/src/Form/SettingsForm.php).
Drupal\klaro\Form\SettingsForm->buildForm()
call_user_func_array() (Line: 528)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Proposed resolution

change code:

'#default_value' => implode("\n", $config->get('deletable_cookie_domains')),

in SettingsForm.php

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @marianrk
  • 🇩🇪Germany jan kellermann

    Thank you for reporting!

    I cannot reproduce and checked the code. The default config is an empty array and while saving always an array is saved.

    Can you please send the current config value of klaro.settings.deletable_cookie_domains (e.g. via contact form to avoiding exposure your domain)?
    Can you please tell us what steps you took before the error occurred?

    Thank you in advance!

  • Well I am n ot sure If you ever will be able to simulate that problem.

    But I can provide as much info as I can.

    1.) To answer your request:
    ddev drush cget klaro.settings deletable_cookie_domains
    [error] Config klaro.settings does not exist
    Failed to run drush cget klaro.settings deletable_cookie_domains: exit status 1

    but at /admin/config/user-interface
    it does exist link to Klaro config.

    So it has something to do with messed up install. That isnt ideal at all. I managed to have working config page somehow (I will note that later)

    About project:
    It is multidomain project, so it can be simulated on ddev enviroment.:
    For example:
    .ddev > config.yaml
    additional_hostnames:
    - en-www123
    - es-www123

    And in drupal:
    /admin/config/regional/language/detection/url
    default lang: www123.ddev.site
    en lang: en-www123.ddev.site
    es lang: es-www123.ddev.site

    + there was installed and configured: https://www.drupal.org/project/eu_cookie_compliance
    And all with version Drupal 11.1.7

    2.) About error:
    It probably somehow conflict with eu_cookie_compliance or eu_cookie_compliance didnt do clear uninstall.
    I uninstalled eu_cookie_compliance and than installed Klaro.
    I dont remember if I managed this only via drush console. But maybe with several reinstalls yes.

    3.) How I managed get working config page?

    a)
    ddev composer require 'drupal/klaro:^3.0'
    ddev drush pm:enable drupal/klaro
    In PmCommands.php line 342:

    Unable to install modules drupal/klaro due to missing modules drupal/klaro.

    note: module is present
    /modules/contrib/klaro

    b)
    enable from admin (when drush not capable) -->

    /admin/modules

    Version: 3.0.6

    Module Klaro Cookie & Consent Manager has been installed. Configure related permissions.

    /admin/people/permissions/module/klaro

    - Module Permissions - Use Klaro! UI
    The changes have been saved.

    c)
    attempt to access admin configuration page for klaro module

    /config/user-interface
    Klaro - Configure the Klaro consent manager link is visible

    /admin/config/user-interface/klaro
    - page is working

    So i skipped uninstall eu_cookie_compliance and I also deleted saved cookies in browser (maybe that is key part)

    But general problem is that I was not able to install Klaro module via drush console.

  • 🇩🇪Germany jan kellermann

    To install via drush please use

    ddev drush pm:enable klaro

    instead of ddev drush pm:enable drupal/klaro

  • Command: ddev drush pm:enable klaro
    works.

    But problem is still there and I think it was caused with uninstall module: eu_cookie_compliance
    Than install Klaro.

    If I install Klaro and than uninstall eu_cookie_compliance it work fine.

  • 🇩🇪Germany jan kellermann

    Do you have an idea, WHY your config set is empty? Did you used klaro_migrator from eu-cookie-compliance?

Production build 0.71.5 2024