function template_preprocess_civicrm_entity in CiviCRM Entity 8.3
Implements hook_preprocess().
File
- ./
civicrm_entity.module, line 258 - Module file for the CiviCRM Entity module.
Code
function template_preprocess_civicrm_entity(&$variables) {
// Add fields as content to template.
$variables += [
'content' => [],
];
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
// Add the view_mode to the template.
$variables['view_mode'] = $variables['elements']['#view_mode'];
// Add the bundle to the template.
$variables['entity_type'] = _civicrm_entity_get_entity_type_from_elements($variables['elements']);
}