function domain_nav_render in Domain Access 5
Same name and namespace in other branches
- 6.2 domain_nav/domain_nav.module \domain_nav_render()
- 7.3 domain_nav/domain_nav.module \domain_nav_render()
- 7.2 domain_nav/domain_nav.module \domain_nav_render()
Renders output for the block.
This function is extracted for use in your themes. Just call: domain_nav_render($paths = 0, $style = 'default');
Parameters
$paths: A boolean flag indicating how to write links to other domains: 0 == link to home page of selected domain 1 == link to current url on selected domain
$style: Indicates which theme function to invoke. Default options are: 'default' == theme_domain_nav_default() 'menus' == theme_domain_nav_menus() 'ul' == theme_domain_nav_ul()
Return value
A themed HTML object for navigation.
1 call to domain_nav_render()
- domain_nav_block in domain_nav/
domain_nav.module - Implement hook_block()
File
- domain_nav/
domain_nav.module, line 124 - Navigation block and menu options for Domain Access
Code
function domain_nav_render($paths = NULL, $style = NULL) {
global $_domain;
// Get the options and set the variables.
if (empty($paths)) {
$paths = variable_get('domain_nav_block', 0);
}
if (empty($style)) {
$style = variable_get('domain_nav_theme', 'default');
}
$options = array();
$domains = domain_domains();
// Select which path calculation to use.
$paths == 0 ? $func = 'domain_get_path' : ($func = 'domain_get_uri');
foreach ($domains as $key => $value) {
$allow = TRUE;
// If the domain is not valid, we disable it by default.
if (!$value['valid']) {
if (user_access('administer domains')) {
$value['sitename'] .= ' *';
}
else {
$allow = FALSE;
}
}
if ($allow) {
if ($_domain['subdomain'] == $value['subdomain']) {
$value['active'] = TRUE;
}
$path = $func($value);
$value['path'] = $path;
// Allow other modules to add elements to the array.
$extra = array();
$extra = module_invoke_all('domainnav', $value);
$value = array_merge($value, $extra);
$options[$value['domain_id']] = $value;
}
}
$theme = 'domain_nav_' . $style;
$content = theme($theme, $options);
return $content;
}