You are here

function widgets_block_content in Widgets 6

Assemble block content.

@todo Check parent pages if no widgets where defined for current page and setting "inherit" is checked.

1 call to widgets_block_content()
widgets_block_view in ./widgets.block.inc
View operation of hook_block().

File

./widgets.block.inc, line 48
Implementaion of block functions for Widgets module.

Code

function widgets_block_content($delta) {
  $output = '';

  // Are we viewing a node?
  if (is_numeric(arg(1))) {
    module_load_include('inc', 'widgets');

    // Load node.
    $node = node_load(arg(1));
    if ($node->disable_widgets) {
      return;
    }

    // Use deafault widgets?
    if ($node->default_widgets) {
      $selected = widgets_get_default($node->type);
    }
    else {

      // Get selected widgets.
      $selected = widgets_get_selected(arg(1));
    }

    // Assemble output.
    foreach ($selected as $widget) {
      $n = node_load($widget);
      $output .= node_view($n, FALSE, FALSE, FALSE);
    }
  }
  return $output;
}