function hook_render_block

4.x blocks.module hook_render_block($delta)
5.x blocks.module hook_render_block($delta)

Example of hook_render_block

Modules wishing to provide blocks should implement this function as well as hook_blocks. It is expected that you will return an array describing how to draw the block on the screen, as shown below. The "delta" is the same as the index of the array element defined in hook_blocks().

Parameters

unknown_type $delta:

See also

hook_blocks

4 functions implement hook_render_block()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

announcements_render_block in modules/announcements/announcements.module
Called when it is time to render the block in question. Expected to return an array which looks like this: array( "title" => "Some title goes here.", "body" => "this is the primary body of the block", );
blocks_render_block in modules/blocks/blocks.module
Implementation of hook_render_block. We are going to render out our content_block content type.
content_render_block in modules/content/content.module
Called when it is time to render the block in question. Expected to return an array which looks like this: array( "title" => "Some title goes here.", "body" => "this is the primary body of the block", );
system_render_block in modules/system/system.module

File

modules/blocks/blocks.module, line 326

Code

function hook_render_block($delta) {

  $block = array();

  if ($delta == "tools") {
    $block ["title"] = t("Tools");
    $block ["body"] = fp_render_menu_block("", "tools");
  }

  if ($delta == "admin_tools") {
    $block ["title"] = t("Administrative Tools");
    $block ["body"] = fp_render_menu_block("", "admin-tools");
  }

  if ($delta == "login_form") {
    $block ["title"] = t("Please log in below...");
    $block ["body"] = fp_render_form("system_login_form");
  }


  // We don't want empty blocks to show up at all.
  if ($block ["body"] == "") {
    return FALSE;
  }


  return $block;
}