I am creating templates using hook_theme. It works fine, but should I be filtering the output? I am accessing it via ['und'][0]['value'], but this doesn't seem right
Specifically in the code below $model_name, $description
function dc_car_guide_theme($existing, $type, $theme, $path){
return array(
'dc_car_makes' => array(
'variables' => array('makes' => array()),
'template' => 'theme/makes'
),
'dc_car_models' => array(
'variables' => array('models' => array(), 'make' => ''),
'template' => 'theme/models'
),
'dc_car_model' => array(
'variables' => array('photos' => array(), 'make' => '', 'model' => '', 'description' => ''),
'template' => 'theme/model'
),
);
}
function dc_car_guide_model($model_id)
{
$model = entity_load_single('field_collection_item', $model_id);
$host_entity = $model->hostEntity();
$make_node = node_load($host_entity->nid);
$model_name = $model->field_model_name['und'][0]['value'];
$description = $model->field_writeup['und'][0]['value'];
return theme('dc_car_model', array('photos' => array(), 'make' => $make_node->title, 'model' =>$model_name, 'description' => $description));
}