Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The JavaScript creating the popup assume the template to contain only a single top-level HTML element. This causes problems when the user tries to add multiple HTML elements on that same level.
i.e.
<div>
<div class ="popup-content info">
<div id="popup-text">
<?php print $message ?>
</div>
<div id="popup-buttons">
<button type="button" class="agree-button"><?php print t("Yes, I agree"); ?></button>
<button type="button" class="find-more-button"><?php print t("No, I want to find out more"); ?></button>
</div>
</div>
</div>
<div>
Some more HTML
</div>
Comment | File | Size | Author |
---|---|---|---|
#1 | eu-cookie-compliance-multi_html_elements-1864752-1.patch | 725 bytes | piepkrak |
Comments
Comment #1
piepkrak CreditAttribution: piepkrak commentedHereby a patch which solves the issue by appending the rendered template contents to an extra container div.
Comment #2
achtonpieprak: thanks for the patch, but I am not entirely convinced about the use case. What prevents you from doing e.g.:
Can you elaborate on your bug report?
Comment #3
piepkrak CreditAttribution: piepkrak commentedSorry for the delayed response Achton. I agree it is an edge case. However I feel this is something to fix. The problem is that a themer has to take into account that there may be only one HTML element at root level in the template. This is not documented and also not handled by code. When multiple elements are added at root level, as described in the bug report, the module's behavior changes into an undesirable state.
My patch makes sure themers don't have to worry about the contents of the template file, while the JavaScript takes care of the single root element.
Comment #4
svenryen CreditAttribution: svenryen commentedI saw no problems when having multiple root elements in the template code. Feel free to re-open if you can show an URL that has problems due to how the module places the div.