Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I want to get a <br> tag into a block-title but by default the brackets are turned into html characters. My theme's block.tpl is

<h2<?php print $title_attributes; ?>><?php print $block->subject; ?></h2>

so it looks like the rendering isn't happening there. I can't find where $block->subject is getting processed. It's not in my theme's template.php. So where in core is $block->subject assembled?

share|improve this question

2 Answers 2

You may be interested in Block Class Styles, which has an additional feature:

Allows the ability to set a global text format for custom block titles; this allows you to now have HTML in your custom block titles. Yes, you can now have block titles that contain HTML markup!

share|improve this answer

Found the line in block.module:

$block->subject = $block->title == '<none>' ? '' : check_plain($block->title);

Decided to skip any fanciness and just replace $block->subject with $block->title in my block.tpl.php. Easy.

share|improve this answer
2  
careful. Core does this to disallow HTML in block titles -- this is to avoid an authorized user from creating content that contains HTML to cross-link titles to malicious domains. –  tenken Jan 14 '13 at 19:25
    
Thanks, yes. This is for a site with only trusted users. Is there a better filter for html that still lets <br> tags through? –  alexvance Jan 14 '13 at 19:40
1  
Drupal doesnt care about "trusted users". It assumes everyone is potentially malicious -- because your site could be hacked and an un-trusted user could submit a blog post, or create a block for instance. Dont get me wrong -- I've done something similiar for a project as well. As a CMS drupal sanitizes all "titles" that come from user input. –  tenken Jan 14 '13 at 20:05
    
Right, that's what I meant - the users are trusted by me, not necessarily Drupal. :) –  alexvance Jan 14 '13 at 20:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.