Problem/Motivation

When using Clean Markup: Blocks with the Bootstrap theme, the title wrapper is not output.

Upon investigation, it appears this is due to the following code in the Bootstrap theme's theme/block/block.vars.php:bootstrap_process_block():

  $variables['title'] = $variables['block']->subject;

Proposed resolution

Unknown at this time.

Remaining tasks

Unknown at this time.

User interface changes

Unknown at this time.

API changes

Unknown at this time.

Original report by @meecect

I have selected an h3 tag to wrap the block title, but I only get a raw, unwrapped title. I am using a sub-theme of bootstrap and I fear it may be interfering, but I'm not sure.

I see in the changelog that an issue similar to this was fixed in 2.7, but I am running 2.7 already. I also checked to see if the included block.tpl.php matches the one in my sub theme and it does. I don't see any markup representing wrappers in block.tpl.php related to titles. I suppose it is some preprocess function?

Comments

meecect’s picture

I found a bootstrap bug for this:

https://www.drupal.org/node/2329431

mparker17’s picture

Title: Block title is not wrapped » Block title wrapper not output when using Clean Markup: Blocks with bootstrap-7.x-3.0
Issue summary: View changes
Status: Active » Closed (won't fix)

I've read through #2329431: bootstrap_preprocess_block() should check if title is already set before overriding it, and looked at bootstrap_process_block() in the Bootstrap theme's theme/block/block.vars.php.

I'm not entirely certain why the Bootstrap maintainers added that line of code (I haven't looked at the commit history though). Perhaps they were trying to add a backwards-compatibility layer for modules written for Drupal 6?

It's theoretically possible for me to work around this in the Clean Markup module by putting corresponding $variables['block']->subject = $variables['title'] line in clean_markup_blocks_preprocess_block(), but I think that would be a very bad idea because $variables['block'] is supposed to be the original block object retrieved from the database: I'm afraid modifying it in that way would open a cross-site-scripting (XSS) attack vector and/or cause problems with other modules...

For this reason, I'm going to mark this issue as "won't fix". However, if you can think of a better solution than the one I mentioned in the last paragraph, feel free to re-open the issue and explain your solution.

meecect’s picture

I agree with you. This is a bootstrap issue, not a clean markup issue.

psiegel’s picture

Hello,

I have the same issue with the Omega 4 theme. It seems the issue comes from the module and the theme using the same variable (title) and overwriting it. And the Zen theme has the same type of issues.

There is already an issue for omega 4 about this: https://www.drupal.org/node/2053877

According to
http://api.drupal.org/api/drupal/modules--block--block.tpl.php/7
The block title should be $block->subject.
Currently the variable is set to $title.

I am wondering if this should not be taken care of in in clean markup?

Best,
Pascal