You are here

function dynamicload_block_data in Javascript Tools 5

Load dynamicload settings for a block or all blocks.

2 calls to dynamicload_block_data()
dynamicload_footer in dynamicload/dynamicload.module
Send settings to the browser.
dynamicload_form_alter in dynamicload/dynamicload.module
Implementation of hook_form_alter().

File

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

Code

function dynamicload_block_data($module = NULL, $delta = NULL) {
  static $blocks = NULL;
  if ($blocks == NULL) {
    $blocks = array();
    $result = db_query("SELECT * FROM {dynamicload_blocks}");
    while ($block = db_fetch_array($result)) {
      foreach (array(
        'refresh',
        'apply',
      ) as $key) {
        $block[$key] = (bool) $block[$key];
      }
      $block['type'] = 'block';
      $block['selector'] = '#block-' . $block['module'] . '-' . $block['delta'];
      $blocks[$block['module'] . '_' . $block['delta']] = $block;
    }
  }
  if ($module !== NULL && $delta !== NULL) {
    return $blocks[$module . '_' . $delta] ? $blocks[$module . '_' . $delta] : array();
  }
  else {
    return $blocks;
  }
}