function bricks_preprocess_entity in Bricks 7.4
Same name and namespace in other branches
- 7.5 bricks.module \bricks_preprocess_entity()
Preprocesses variables for entity.tpl.php.
File
- ./
bricks.module, line 61
Code
function bricks_preprocess_entity(&$vars) {
$element =& $vars['elements'];
if (!empty($element['#options']['classes'])) {
$vars['classes_array'][] = check_plain($element['#options']['classes']);
}
if ($element['#entity_type'] == 'brick') {
$vars['title'] = '';
if (!empty($vars['content']['field_title']['#items'][0]['value'])) {
$vars['title'] = $vars['content']['field_title']['#items'][0]['value'];
unset($vars['content']['field_title']);
}
$base_heading_level = isset($element['#base_heading_level']) ? $element['#base_heading_level'] : 1;
$element['#heading_level'] = $base_heading_level + !empty($vars['title']);
if ($element['#bundle'] == 'body' && isset($vars['content']['field_body'])) {
$vars['content']['bricks'] = _bricks_tree_items($element['field_body'], $vars['content']['field_body']);
unset($vars['content']['field_body']);
}
}
}