Closed (fixed)
Project:
EU Cookie Compliance (GDPR Compliance)
Version:
8.x-1.11
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Oct 2020 at 14:32 UTC
Updated:
5 Nov 2020 at 14:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
svenryen commentedI don't think this is a bug in our module. The problem is that no user is available when the default filter is looked up. I'm not sure what we can do about that.
I also tried the same procedure when starting from the Standard and Umami profiles, but the drush installer didn't support those.
Are you able to find a different profile that works when installing from Drush?
@jollysolutions - Is this something you typically do (Installing drupal with minimal profile through Drush)?
Comment #3
jollysolutionsI have found that adding
to this modules exported config solves the issue
Comment #4
svenryen commentedI debugged it a bit further, and the problem is that
\Drupal::entityTypeManager()->getStorage('filter_format')->loadByProperties(['status' => TRUE])on line114infilter.modulereturns an empty array. I also tried to enforce that Drupal would use UID 1 when selecting the formats. The$format['all']array was still empty.I think the only recommendation I can use is to keep EU Cookie Compliance out of your config and enable it manually - either through UI or via Drush once Drupal is installed - this seems to be a weakness in either
Drush sior Drupal core.Comment #5
svenryen commentedComment #6
jollysolutionsI agree that an empty array is returned but on an config install you are trying to get the default of something that hasn't got a default yet and the default can change depending on the permissions of the current user. Instead I think the module should use the fallback filter as this is always guaranteed to be available as per
https://api.drupal.org/api/drupal/core%21modules%21filter%21filter.modul...
And during module install the default configuration the module provides is "existing content" the module should use the fallback format.
Comment #7
jollysolutionsThis is also not drush specific as it happens when installing from existing config using the web interface.
Comment #8
svenryen commentedApologies that I stated it was a Drush specific problem. I take that back.
We added the part of the code that you're complaining about because a major issue was filed by several people that were having problems using the module at all when installing on the Lightning distribution (or on any site that doesn't have the Restricted HTML in config).
Your problem is different, and I haven't been able to find a way to fix it in code.
All I can conclude is at the time of installation, even user 1 doesn't have any text formats available when we're installing the module.
Have you tried with "fallback format" and does it work?
Comment #9
svenryen commentedI tried filter_fallback_format. It returns 'plain_text'. I still consider it a core bug that filter_default_format() doesn't work, and it would be more fruitful to figure out why that fails than having to force all users of the module to change the format from plain text to HTML after they have installed the module.
We can't set the format to 'plain text'.
Comment #10
svenryen commentedI also tried filter_fallback_format during a regular module install, and it seems to always return 'plain_text'.
I understand this is a problem for you, but I really can't fix the problem the way you suggest.
Comment #11
svenryen commentedHappy to say, here's a patch for you. It needs testing against the Lightning distribution before it can make it into the module.
Comment #12
svenryen commentedThat being said, you do realize that with a config set from a minimal profile, your html will render as text for all banners in this module, so maybe a good solution for you would be to add at least one other text format to the config before you export?
Comment #14
svenryen commentedComment #15
jollysolutionsThank you very much for the patch. I can confirm that it does work for us. And in our case the config is only based on minimal has that is the only profile that does not have any install hooks and so can be installed as existing config. We have filters that do display the HTML correctly.
Tested with Lightning as per the original issue and works there. Marking as RTCB and thank you again.
Comment #17
svenryen commentedComment #18
eiriksmHello, thanks for fixing this!
Could we get a new release with this fix? The current release is currently "unusable" for us.
Thanks again! :)
Comment #19
svenryen commentedYou'll have a new release by Monday. I have a few more patches that I'd like to include.
Comment #20
dspachos commentedHi! Any news about the upcoming new patch? We are interesting in the patch, since we have some failing tests in our case.
Comment #21
svenryen commentedAs promised, there was a release by Monday. We included
eu_cookie_compliance-error-when-installing-minimal-profile-config-export-3176439-11.patchin the release.If you have problems, are they related to this issue? If not, could you please open a new issue. Thanks!
Comment #22
dspachos commentedThanks very much! I'm going to try and I'll update here.