I really like this - always been a bit fan of insert view, but this is a great addition. My problem is that the block is coming out with the title on it and it is the title created by the module. Is there any way to either remove the title all together or to use the title overide in the block settings instead?

Thanks,
Adam

Comments

zmove’s picture

Hi,

I confirm this issue and subscribe for a solution. This module don't care about the block setting for the title. Result, it shouldn't show the title when it is set as into the block configuration.

pasqualle’s picture

Title: How can I get rid of the title? Or change to title overide? » Change the theme function
Category: support » bug

The problem is that insert_block module uses its own theming function, which is unnecessary (and wrong, as it does not check the title)

line 82

$repl[] = theme('insert_block_block', $block);

should be changed to

$repl[] = theme('block', $block);

and all the theme related code can be removed..

pasqualle’s picture

Status: Active » Needs review
StatusFileSize
new3.85 KB
new1.88 KB

actually this does not help as the block setting is not loaded, so the code does not know about if the block title is set to <none> or not.

But changing to core theme_block function, enables the use of new template files

function template_preprocess_block(&$variables) {
...
  $variables['template_files'][] = 'block-'. $variables['block']->region;
  $variables['template_files'][] = 'block-'. $variables['block']->module;
  $variables['template_files'][] = 'block-'. $variables['block']->module .'-'. $variables['block']->delta;

so you can use the template by region, where you can remove the title
block-insert_block.tpl.php (based on block.tpl.php)

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="block block-<?php print $block->module ?>">
  <div class="content">
    <?php print $block->content ?>
  </div>
</div> 

attached the patch, and the patched module file..

pasqualle’s picture

Category: bug » feature
dboulet’s picture

Title: Change the theme function » Use theme_block() to render blocks
Version: 6.x-1.x-dev » master
StatusFileSize
new2.18 KB

Thanks Pasqualle for the code, it was just what I was looking for. Unfortunately, the patch provided in comment #3 didn't work for me, so I've included a new one, rolled against HEAD.

I've also added a database call which fetches the block title, and then erases it if it is set to <none>.

pasqualle’s picture

instead of additional db query I would prefer an additional parameter, to show or hide the title. In most cases you want to hide the block title if you put it into a template or node, but you want to show the block title if you put that block into a region.. So those should be 2 different settings..

like

[block:module=delta=hide_title]
[block:profile=0=TRUE]

This way the functionality of insert_view and insert_block would be the same as in the quicktabs module..

ron_mahon’s picture

Great Code But what I really need is a way to show one part of a menu (block) expanded!
Any thoughts on this?
Regards
Ron

JamesK’s picture

In patch #5, the following change should be made to account for a module's default title:

Replace:

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

With:

if ($title) {
  $block->subject = $title == '<none>' ? '' : check_plain($title);
}
verta’s picture

subscribing to the thread, any plans for a 1.0 release (not dev)?

j0nathan’s picture

subscribing

danny englander’s picture

subscribing, same issue. The patch in # 5 worked.

dealancer’s picture

StatusFileSize
new1.7 KB

Here is another patch for menu.inc of core. It fixes bug in title in a another way. It executes SQL query to SELECT block name. It also adds div to wrap content and title.

summit’s picture

Subscribing, greetings, Martijn

mrfelton’s picture

Patch in #5 works for me. Thanks.

danny englander’s picture

Here is another patch for menu.inc of core...

@dealancer -- probably not the greatest idea to hack core :)

nancydru’s picture

Patch in #5 looks good and is in keeping with http://api.drupal.org/api/drupal/developer--theme.php/function/theme_blo....

Patch in #12 doesn't follow coding standards, and may not be needed with #5 in place.

nancydru’s picture

This patch would take care of the symptoms of #489116: Displaying inserted blocks.

phiscock’s picture

Happy with Patch #5

zoo’s picture

#5 works for me too. zoo

TimelessDomain’s picture

Patch #5 does not work for d7, can someone please re-roll it?

firebus’s picture

Status: Needs review » Reviewed & tested by the community

patch #5 worked for me as well

JamesK’s picture

Status: Reviewed & tested by the community » Needs work

See #8

firebus’s picture

Thanks JamesK - I didn't get the point of your comment in #8 on first reading.

If there is no title set in block configuration, then the block should be displayed with its default title. The patch in #5 breaks this. And the suggestion in #8 fixes it.

Here's a re-roll of #5 with those changes. I also replaced the db_query with db_query_range, taking the LIMIT statement out of the SQL.

Here is also a patch for D7. The D7 version is very different (and a little simpler), since you cannot invoke theme('block', $block) in D7 the way you could in D6.

dboulet’s picture

Status: Needs work » Needs review

Thanks firebus.

carl.brown’s picture

Hey, thanks Firebus. That D7 patch (#23) worked for me - I'm also using Block Theme and this now plays nicely with that module too. Happy days.

liam11’s picture

The patch in #23 worked perfect (D6), thanks.

captex360’s picture

Fixed.

firebus’s picture

Assigned: Unassigned » firebus
Status: Needs review » Reviewed & tested by the community

since people seem to be happy with this patch, i'm moving to RTBC

mlsamuelson’s picture

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

Thanks everyone for the patches and testing. I've committed the patches in #23 to both the D6 and D7 branches.

If all is quiet for a week or so, after these updates, I'll see about doing some actual releases instead of dev copies.

  • Commit 3f388b4 on 7.x-1.x, 8.x by mlsamuelson:
    Issue #359088 - thanks firebus - D7 patch to fix title handling issues
    
    

  • Commit 3f388b4 on 7.x-1.x, 8.x, 8.x-1.x by mlsamuelson:
    Issue #359088 - thanks firebus - D7 patch to fix title handling issues