You are here

function dynamicload_fetch_block in Javascript Tools 5

Menu callback to return a rendered block in JSON format.

1 string reference to 'dynamicload_fetch_block'
dynamicload_menu in dynamicload/dynamicload.module
Implementation of hook_menu().

File

dynamicload/dynamicload.module, line 367
Enable AJAX-based loading of selected page elements.

Code

function dynamicload_fetch_block($module, $delta) {
  global $theme_key;
  if (!isset($theme_key)) {
    init_theme();
  }
  $region = db_result(db_query("SELECT region FROM {blocks} WHERE module = '%s' AND delta = %d AND theme = '%s'", $module, $delta, $theme_key));
  $blocks = block_list($region);
  if (isset($blocks[$module . '_' . $delta])) {
    print drupal_to_js(array(
      'result' => TRUE,
      'content' => theme('block', $blocks[$module . '_' . $delta]),
    ));
  }
  else {
    print drupal_to_js(array(
      'result' => FALSE,
      'content' => NULL,
    ));
  }
  exit;
}