You are here

function ajaxblocks_is_ajax in Ajax Blocks 6

Same name and namespace in other branches
  1. 7 ajaxblocks.module \ajaxblocks_is_ajax()

Returns TRUE if the block is configured to be loaded via AJAX. Block specific settings are also returned.

3 calls to ajaxblocks_is_ajax()
ajaxblocks_ajax_handler in ./ajaxblocks.module
Handles AJAX request and returns the content of the appropriate blocks.
ajaxblocks_form_block_admin_configure_alter in ./ajaxblocks.module
Implements hook_form_FORM_ID_alter(). Adds AJAX settings to the block configure page.
ajaxblocks_preprocess_block in ./ajaxblocks.module
Implements hook_preprocess_block().

File

./ajaxblocks.module, line 197
Loads dynamic blocks on cached page for anonymous users by performing AJAX request.

Code

function ajaxblocks_is_ajax($block_id, &$settings) {
  static $ajax_blocks = NULL;
  if (is_null($ajax_blocks)) {
    $cached = cache_get('ajaxblocks');
    if ($cached) {
      $ajax_blocks = $cached->data;
    }
    else {
      $ajax_blocks = ajaxblocks_update_cache();
    }
  }
  if (array_key_exists($block_id, $ajax_blocks)) {
    $settings = $ajax_blocks[$block_id];
    return TRUE;
  }
  $settings = array();
  return FALSE;
}