Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By terrencewood on
I have a block that display's secondary links based on the context from the primary link
<?php
$localNav = _menu_get_active_trail();
if($localNav[1]) {
$local = theme_menu_tree($localNav[1]);
print $local;
}
?>
Is there any way to set the block title from within the block body?
Comments
either
in the theme by editing block.tpl.php
or
by creating a simple module just for the block
Here is an example module to create the block:
http://api.drupal.org/api/4.7/file/developer/examples/block_example.modu...
You wouldn't have to use all the stuff in there eg I think you could get rid of the "save" and "configure" operations in block_example_block() as you shouldn't need them.
http://api.drupal.org/api/4.7/function/hook_block
Doing it in the theme is a bit easier than a module, but not as clean or elegant because it isn't really a theme function.
--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ