function dynamicload_menu in Javascript Tools 5
Implementation of hook_menu().
File
- dynamicload/
dynamicload.module, line 35 - Enable AJAX-based loading of selected page elements.
Code
function dynamicload_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'dynamicload/js',
'title' => t('Dynamicload page'),
'access' => user_access('access content'),
'type' => MENU_CALLBACK,
'callback' => 'dynamicload_js',
);
$items[] = array(
'path' => 'dynamicload/block',
'title' => t('Dynamicload block'),
'access' => user_access('access content'),
'type' => MENU_CALLBACK,
'callback' => 'dynamicload_fetch_block',
);
$items[] = array(
'path' => 'admin/settings/dynamicload',
'title' => t('Dynamicload'),
'description' => t('Configuration for dynamic loading'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'dynamicload_admin_settings',
),
);
}
else {
/*
if (isset($_COOKIE['has_js']) && $_COOKIE['has_js'] && variable_get('dynamicload_all', 0)) {
// If we are on a page other than home, go home, with this page as an anchor/hash.
if (!isset($_SESSION['dynamicload_path']) && !drupal_is_front_page() && arg(0) != 'dynamicload') {
$query = $_GET;
unset($query['q']);
$querystring = array();
foreach ($query as $key => $value) {
$querystring[] = $key .'='. $value;
}
$path = drupal_get_path_alias($_GET['q']);
$_SESSION['dynamicload_path'] = $path;
drupal_goto('', implode('&', $querystring), $path);
}
elseif (isset($_SESSION['dynamicload_path']) && !(isset($_SESSION['dynamicload_path']) && $_SESSION['dynamicload_path_active'])) {
$_SESSION['dynamicload_path_active'] = TRUE;
$path = $_SESSION['dynamicload_path'];
$_GET['q'] = drupal_get_normal_path($path);
_menu_append_contextual_items();
menu_set_active_item($path);
unset($_SESSION['dynamicload_path_active']);
unset($_SESSION['dynamicload_path']);
}
}
*/
dynamicload_load();
}
return $items;
}