domain_nav_render($paths = NULL, $style = NULL)
domain_nav/domain_nav.module, line 124
Renders output for the block.
This function is extracted for use in your themes. Just call: domain_nav_render($paths = 0, $style = 'default');
$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()
A themed HTML object for navigation.
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;
}