function og_theme_custom_theme in Organic groups theme 7
Same name and namespace in other branches
- 7.2 og_theme.module \og_theme_custom_theme()
Implements hook_custom_theme().
Change the theme, based on a group context.
File
- ./
og_theme.module, line 54 - Associate theme to a group.
Code
function og_theme_custom_theme() {
if ($group = og_context()) {
// Load the entity.
$entity = $group
->getEntity();
// Check if a theme field exists, and it isn't defined as "default"
// (i.e. use the default site theme).
if (!empty($entity->{OG_THEME_FIELD}[LANGUAGE_NONE][0]['value']) && $entity->{OG_THEME_FIELD}[LANGUAGE_NONE][0]['value'] != '__default') {
return $entity->{OG_THEME_FIELD}[LANGUAGE_NONE][0]['value'];
}
}
}