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
Comment #2
flomar commentedComment #3
flomar commentedComment #4
joachim namysloWith 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.
Comment #5
joachim namysloDebugging 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
Comment #6
Mirroar commentedVersion 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.
Comment #7
Mirroar commentedHere'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?
Comment #8
Mirroar commentedHere'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.
Comment #9
joachim namysloAny update on this one
Comment #10
sascha_meissnerHey 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
Comment #11
joachim namysloThat's great news. It tooked while, but it is great news. Thank you.
Comment #12
sascha_meissnerThis should be fixed in the new 3.0.0-rc1 release :)
Comment #13
sascha_meissnerComment #14
sascha_meissner