In my theme’s preprocess node function i’m trying to create a new variable by combining 2 existing fields, both of which are text strings. pseudo code is this:
$teachers_name = $firstname + $lastname;
When looking at a print out of the Teacher object using Devel, i see the field first name is an array, structured like this…
field_first_name
und
0
safe_value ‘Lisa’
but so far it’s not working at all. i’m not accessing the variables correctly.
function myTheme_preprocess_node(&$variables){
if($variables['type']=='teacher') {
$variables['teachers_name'] = $variables['field_first_name’][‘und’][0] [‘safe_value’];
}
how can i access the text string of field 'first name'? thanks!