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>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

piepkrak’s picture

Status: Active » Needs review
FileSize
725 bytes

Hereby a patch which solves the issue by appending the rendered template contents to an extra container div.

achton’s picture

pieprak: thanks for the patch, but I am not entirely convinced about the use case. What prevents you from doing e.g.:

<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>
    Some more HTML
  </div>
</div>

Can you elaborate on your bug report?

piepkrak’s picture

Sorry 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.

svenryen’s picture

Issue summary: View changes
Status: Needs review » Closed (works as designed)

I 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.