i have the following array:
$keyvisual_data = array(
'video_file' => $row->field_field_video[0]['rendered']['#item']['uri'],
'bild_file' => $row->field_field_bild[0]['rendered']['#item']['uri'],
'subline_src' => $row->_field_data['nid']['entity']->field_key_titel['und'][0]['safe_value'],
'screenreader_src' => $row->field_field_alt_screenreader[0]['rendered']['#markup'],
'alt_src' => $row->field_field_bild[0]['rendered']['#item']['alt']
);
it might happen that some of the fields are not set, this is okay. in fact i am getting this PHP notice:
Notice: Undefined offset: 0 in bafa_insert_keyvisual() ………..
is it somehow possible to assign a default value to each key in case it is undefined WITHOUT checking each field of the array manually?
thanks for help
Yes, add
@before the field like:and then initialize the nulls:
etc…