You are here

function block_refresh_block_content in Block Refresh 7

Same name and namespace in other branches
  1. 5 block_refresh.module \block_refresh_block_content()
  2. 6 block_refresh.module \block_refresh_block_content()
  3. 7.2 block_refresh.module \block_refresh_block_content()

page callback for /block_refresh/[module]/[delta] displays the block content, without any other page information

1 string reference to 'block_refresh_block_content'
block_refresh_menu in ./block_refresh.module
Implements hook_menu(). DRUPAL 7 STATUS: WORKING!

File

./block_refresh.module, line 140

Code

function block_refresh_block_content($module = NULL, $delta = NULL) {

  // If there is a request directly to /block_refresh...
  if (!isset($module) || !isset($delta)) {
    drupal_not_found();
  }
  $block_id = drupal_html_id('block-' . $module . '-' . $delta);
  $settings = variable_get('block_refresh_settings', array());

  // If automatic refresh AND manual refresh are both disabled...
  if (!$settings[$block_id]['auto'] && !$settings[$block_id]['manual']) {
    drupal_not_found();
  }

  //Validate args and get referrering page args from end.  Set as path.
  $args = arg();
  if (!empty($args[3]) && $args[0] == 'block_refresh' && $args[1] == $module && $args[2] == $delta) {
    unset($args[0]);
    unset($args[1]);
    unset($args[2]);
    $_GET['q'] = implode('/', $args);
  }
  else {
    $_GET['q'] = '';
    $args = arg();
  }

  // Run the block_view hook from the block module
  $block = module_invoke($module, 'block_view', $delta);

  // Print out the content of the proceeding call
  print render($block['content']);
}