- Issue created by @scontzen
- π©πͺGermany guido_s Cologne
Content can't be kept as this what needs to be blocked.
It must be done somewhat like in cookies_addons_views.
Thought I had seen something like this in the code when I checked @_shy s code. But as mentioned didn't have the time to check the rendered output myself.
@_shy said it would be working fine. If not that needs to be fixed. Everything needs a proper placeholder div which is replaced after cookie consent for the specific category. - First commit to issue fork.
- Merge request !14Issue #3542052: Missing placeholder display for blocked content β (Open) created by _shy
- πΊπ¦Ukraine _shy Ukraine, Lutsk πΊπ¦
Created a PR and attached a patch with the changes for easy testing.
- π©πͺGermany guido_s Cologne
I just tested in Drupal 11.2.3 and can confirm there is a placeholder now on both nodes and blocks, but I also noticed the content of the field isn't blocked now. The placeholder just covers the content of the field.
So this needs more work.<div id="block-olivero-testblockfortestingfieldblockinginblocks" class="block block-block-content block-block-contentbfd273df-2330-489e-be5d-183a295bc5e6"> <h2 class="block__title">Test Block for testing field blocking in blocks</h2> <div class="block__content"> <div class="cookies-fallback--fields--wrap cookies-fallback--wrap disabled"><div class="cookies-addons-fields-placeholder text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item cookies-fallback--element" data-cookies-service="fields" data-service-name="Fields" data-field-id="block_content-1-body" data-view-mode="full" id="block_content-1-body-content">Test body of blocked field</div><div class="cookies-fallback cookies-fallback--fields cookies-fallback--fields--overlay"><div class="cookies-fallback--text">This content is blocked because field cookies have not been accepted.</div><button class="cookies-fallback--fields--btn cookies-fallback--btn">Accept field cookies</button><a href="#cookiesjsrAccept" class="cookies-fallback--link">Accept All Cookies</a></div></div> </div> </div>
- πΊπ¦Ukraine _shy Ukraine, Lutsk πΊπ¦
I reworked the PR. Instead of hiding content with a placeholder, I loop through all field items and clear content inside of each.
This will block content and keep the correct structure to render the placeholder correctly.Please, take a look.