Problem/Motivation

In the event of a Block title consisting of more than one word e.g. About Us, the resulting id generated for the block div contains spaces which is not legal HTML. e.g. id="about us".

Proposed resolution

The bootstrap_agency_preprocess_block() hook function needs editing to replace any spaces with a dash character (-) or similar.

Remaining tasks

Now that I've logged the issue I'll submit a patch for this as it should be a fairly simple fix.

Comments

yeebot’s picture

yeebot’s picture

Assigned: yeebot » Unassigned
yeebot’s picture

Status: Active » Needs review

  • jcnventura committed e26a3f7 on 7.x-1.x
    Issue #2458511: handle multi-word block titles in the 'clean anchors'...
jcnventura’s picture

Status: Needs review » Fixed

Yes, you're right. Although the official way of doing it in Drupal is to call drupal_clean_css_identifier(drupal_strtolower($string)).

But thanks a lot for the heads-up. I hadn't used multiple words titles yet.

yeebot’s picture

Ah... of course. I should have checked first. Thanks for pointing that out.

It might also be worth including drupal_html_id($id) to ensure uniqueness? I did notice this issue when I had 2 blocks with the same title as one contained hidden modal content. The second block ended up with a blank id.

  • jcnventura committed e9f64f4 on 7.x-1.x
    Issue #2458511: use drupal_html_id() to ensure id uniqueness.
    
jcnventura’s picture

Thanks for the tip. That one even lowercases and replaces the spaces, so it's the only one needed.

Note however that in my tests, most of the time it did not ensure uniqueness. It may be that the bootstrap base theme is not calling drupal_html_id().

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.