Skip to content
Snippets Groups Projects
Commit a37b8b5b authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

[gh-458] Add menu path to output partial region html

Mimics sharedcode/% html files that used to exist on static UNL templated sites
parent 26746157
No related branches found
No related tags found
No related merge requests found
...@@ -394,6 +394,14 @@ function unl_preprocess_page(&$vars) { ...@@ -394,6 +394,14 @@ function unl_preprocess_page(&$vars) {
function unl_menu() { function unl_menu() {
$items = array(); $items = array();
// Output html snippets for regions.
$items['sharedcode/%'] = array(
'title' => 'sharedcode files',
'access arguments' => array('access content'),
'page callback' => 'unl_sharedcode',
'page arguments' => array(1),
);
// Returns confirmation 'user_loggedin' if user is logged into the system // Returns confirmation 'user_loggedin' if user is logged into the system
$items['user/unl/whoami'] = array( $items['user/unl/whoami'] = array(
'title' => 'UNL Whoami Tool', 'title' => 'UNL Whoami Tool',
...@@ -600,6 +608,48 @@ function unl_menu_alter(&$items) { ...@@ -600,6 +608,48 @@ function unl_menu_alter(&$items) {
$items['admin/modules/uninstall']['access callback'] = 'unl_user_is_administrator'; $items['admin/modules/uninstall']['access callback'] = 'unl_user_is_administrator';
} }
/**
* Custom function that creates html snippet output at sharedcode/% paths to
* mimic files that once existed on static UNL templated sites.
*/
function unl_sharedcode($file = null) {
foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
if ($blocks = block_get_blocks_by_region($region_key)) {
$regions[$region_key] = $blocks;
}
else {
$regions[$region_key] = array();
}
}
switch ($file) {
case 'footer.html':
case 'footer_content':
$region = 'footercontent';
break;
case 'footerContactInfo.html':
case 'contact_us':
$region = 'contactinfo';
break;
case 'navigation.html':
case 'navigation_links':
$region = 'navlinks';
break;
case 'relatedLinks.html':
case 'related_links':
$region = 'leftcollinks';
break;
default:
drupal_not_found();
return;
}
drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
drupal_add_http_header('Content-Language', 'en');
print render($regions[$region]);
exit;
}
/** /**
* Implementation of hook_file_validate(). * Implementation of hook_file_validate().
* Fires when files are uploaded after Drupal Core sanitization but before saving to file system or db * Fires when files are uploaded after Drupal Core sanitization but before saving to file system or db
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment