function panels_ajax_tab_boot in Panels Ajax Tabs 7
Implements hook_boot().
IF Clean-URLs are enabled for any ajax-tab pane, we strip the URL identifier off the end of the URL and place it in $_GET['panels_ajax_tab_trigger']. We additionally put the mini-panel this corresponds to in $_GET['panels_ajax_tab_tab']. Once this is done drupal can handle the URL normally (it won't get confused by the identifier on the end of the URL) and panels-ajax-tabs will look for what tab to load by inspecting $_GET['panels_ajax_tab_tab']. In Essense, it transforms a url like http://example.com/path/to/drupal/page.mytab to a url like http://example.com/path/to/drupal/page?panels_ajax_tab_trigger=mytab&pan....
1 call to panels_ajax_tab_boot()
- panels_ajax_tab_ajax in ./
panels_ajax_tab.module - AJAX callback for rendering tab.
File
- ./
panels_ajax_tab.module, line 133 - Allows users to create and manage Panels Ajax Tabs.
Code
function panels_ajax_tab_boot() {
$config_cache = cache_get('panels_ajax_tab_config_cache');
// If there are no url-cache settings, ensure that the url-cache is rebuilt
// for next-time and skip.
if (empty($config_cache)) {
register_shutdown_function('panels_ajax_tab_config_cache');
return;
}
foreach ($config_cache->data as $config) {
if ($config['clean_url']) {
foreach ($config['mini_panels'] as $panel_id => $panel_conf) {
$delim = $config['clean_url_delim'];
$trigger = $delim . $panel_conf['url_id'];
$pathlen = strlen($_GET['q']);
$triggerlen = strlen($trigger);
if ($triggerlen > $pathlen) {
continue;
}
if (substr_compare($_GET['q'], $trigger, -$triggerlen) === 0) {
$_GET['q'] = substr($_GET['q'], 0, $pathlen - $triggerlen);
$_GET['panels_ajax_tab_tab'] = $panel_id;
$_GET['panels_ajax_tab_trigger'] = $panel_conf['url_id'];
return;
}
}
}
}
}