Due to the way that the core block module implements hook_block, this module doesn't receive the block title for any custom blocks you add using the block module. This is a small patch that will test to see if the block we are showing is from the core block module and if so, it grabs the title field from the blocks table.

I havn't tested this thoroughly but it's working for me.

CommentFileSizeAuthor
randomblocks-title.patch588 bytesBlakeLucchesi

Comments

BlakeLucchesi’s picture

Actually, you probably wanna add a check_plain() around the db_result() just to be safe.

$thisblock['subject'] = check_plain(db_result(db_query("SELECT title FROM {blocks} WHERE module = '%s' AND delta = %d", $block->module, $block->delta)));

davemybes’s picture

Status: Active » Reviewed & tested by the community

Works great for me too. +1

No problems observed with the implementation of this patch (included the check_plain option).

kentjames1980’s picture

Status: Reviewed & tested by the community » Active

Can some please tell me how and where to implement this patch as im a noob to this patch stuff and im struggling to get it to work - where bouts does it go in the module file and is the patch correct in its detail as its lacking } in my eyes when compared to the existing? or does it insert between somewhere?

Please help!

kentjames1980’s picture

Status: Active » Closed (fixed)

fixed via help from dave on email!

davemybes’s picture

Status: Closed (fixed) » Reviewed & tested by the community

You're welcome. However, the issue should still remain open so that the module maintainer can evaluate whether or not to include the patch as part of the module.

fivestarstravel’s picture

I would also like to know where to place the patch. Thanks in advance!

fivestarstravel’s picture

figured out the patch, and have one comment to the offer, at least in regards to the acquia_marina theme.

when using check_plain, title bar will display "<NONE>" for child blocks with no title (blank).

without using check_plain, untitled child blocks will display the styled title bar element with no title/content in it (vs. the default drupal behavior of not displaying the title bar element at all)

not being a php coder, i'm going to try to fix this with a conditional, but don't expect any solution from me anytime soon ;)

fivestarstravel’s picture

Status: Reviewed & tested by the community » Active

changing status back to active

rp7’s picture

Priority: Normal » Critical

Thanks for the temporary patch. I have 1 issue with the patch: it isn't i18n aware. It displays the default language on different language pages.

Any idea how I can run the $thisblock['subject'] through a translator? t() doesn't do the job.