function og_context_preprocess_html in Organic groups 7
Same name and namespace in other branches
- 7.2 og_context/og_context.module \og_context_preprocess_html()
Implement hook_preprocess_html().
HTML preprocess; Add context related templates and CSS.
File
- og_context/
og_context.module, line 75 - Get a group from a viewed page.
Code
function og_context_preprocess_html(&$variables) {
if ($group = og_context()) {
// Add template suggestions.
$variables['theme_hook_suggestions'][] = 'page__group_context';
$variables['theme_hook_suggestions'][] = 'page__group_context__group_' . $group->gid;
$variables['theme_hook_suggestions'][] = 'page__group_context__' . $group->entity_type;
$variables['theme_hook_suggestions'][] = 'page__group_context__' . $group->entity_type . '_' . $group->etid;
// Add CSS.
$clean_html = drupal_html_class('group-context-' . $group->entity_type);
$variables['classes_array'][] = 'group-context';
$variables['classes_array'][] = 'group-context-group-' . $group->gid;
$variables['classes_array'][] = $clean_html;
$variables['classes_array'][] = $clean_html . '-' . $group->etid;
// Add context to JS.
og_context_add_js($group);
}
}