function views_megarow_get_page_theme in Views Megarow 7
Determine which theme should be used to render the megarow.
Since the rendering of this page is triggered on click by a user, our only way to figure out the original page is to rely on the HTTP_REFERER. With this information we can determine if the origin page was an admin path or not and display the appropriate accordingly.
1 string reference to 'views_megarow_get_page_theme'
- views_megarow_menu in ./
views_megarow.module - Implement hook_menu().
File
- ./
views_megarow.module, line 63
Code
function views_megarow_get_page_theme() {
// Find the path of the parent page.
$url = parse_url($_SERVER['HTTP_REFERER']);
// If the Drupal install is in a subdirectory, discard that part.
$path = substr($url['path'], strlen($GLOBALS['base_path']));
// Use the admin theme if it's an admin page.
if (user_access('view the administration theme') && path_is_admin($path)) {
return variable_get('admin_theme', 'seven');
}
else {
// Otherwise use the default theme.
return variable_get('theme_default', 'bartik');
}
}