Problem:

If I check the "Show automatically" box, the module JS throws the error: "Uncaught TypeError: klaro.renderKlaro is not a function
at HTMLDocument. (klaro.drupal.js?qnp0ti:24)"

Steps to reproduce:

Drupal 9.1.3: install, enable and configure the module, check the "Show automatically" box

Quick fix

I couldn't find any renderKlaro() Method in the klaro API.
If I changed the following in klaro.drupal.js, it seems to work as I want
I have never used klaro before, so I am not sure I am doing the right thing:

if (settings.klaro.autoShow) {
    klaro.renderKlaro(settings.klaro.config);
}

to

if (settings.klaro.autoShow && !klaro.getManager(settings.klaro.config).confirmed) {
    klaro.show(settings.klaro.config);
}

Comments

flomar created an issue. See original summary.

flomar’s picture

Issue summary: View changes
flomar’s picture

Issue summary: View changes
joachim namyslo’s picture

With this fix applyed klaro is visible once, again. But after clear cookies klaro is gone away, even if no cookie is set anymore. Also there is an error message for a php function in a different file. So this needs to be checked and fixed. Claro is unusable because of the java-Script error targeted here.

joachim namyslo’s picture

Debugging this issue i came to the conclusion that klaro needs klaro 0.5.x to work correctly. If the verison number of the lib is higher currently there is the js error in the console mentioned in that issue So either this should be fixed by implementing 0.7.x or be mentioned more prominent in documentation not just in change lag

Mirroar’s picture

Version 0.6.5 of the klaro library also works fine with the module currently.
I'm guessing starting with 0.7.0 renderKlaro was changed and renamed to render. Even fixing that in klaro.drupal.js you still get the message "Warning, your configuration file is outdated. Please change `apps` to `services`" in the console, so updating will take a little more work.

We should update the module so it is compatible with newer versions of the klaro library, or specify a supported version range in the readme and on the project hompage.

Mirroar’s picture

Status: Active » Needs review
StatusFileSize
new2.56 KB

Here's a patch to get the module compatible with the 0.7.x set of releases for klaro. Ideally we also need to inform the user on update that they need to download a newer version of the klaro library. Will an update hook that outputs a message suffice?

Mirroar’s picture

StatusFileSize
new2.99 KB

Here's a slightly updated patch that also moves the translation key "app" to "service". A cleaner version would probably rename the key within config forms, adjust the modules config schema, and include an update hook to move the existing data. But if you just need it working, this will do for now.

joachim namyslo’s picture

Any update on this one

sascha_meissner’s picture

Hey I´m working on a new major version that we will release soon with full support for the latest 0.7.3 version of the klaro library

joachim namyslo’s picture

That's great news. It tooked while, but it is great news. Thank you.

sascha_meissner’s picture

Status: Needs review » Fixed

This should be fixed in the new 3.0.0-rc1 release :)

sascha_meissner’s picture

Version: 8.x-2.0-beta2 » 3.0.0-rc1
sascha_meissner’s picture

Status: Fixed » Closed (fixed)