我正在为其中一个视图覆盖字段模板,并且希望能够从$ row变量访问另一个字段值。模板文件上的文档显示了以下内容:
从$ row获取输出时,应使用以下构造:$ data = $ row-> {$ field-> field_alias}
我的字段称为field_calendar_title,但是以下内容无法正常工作:
$row->{$field->field_calendar_title}
我收到以下错误:
致命错误:无法访问空属性...
字段“别名”与内容类型中的字段名称是否不同?
$ row的var_dump的“已清理”输出:
stdClass Object
(
[node_title] => ...
[nid] => 568
[field_data_field_performance_date_delta] => 0
[field_data_field_performance_date_language] => und
[field_data_field_performance_date_bundle] => event
[field_data_field_performance_date_field_performance_date_val] => 2012-03-02 19:00:00
[field_data_field_performance_date_node_entity_type] => node
[_field_data] => Array
(
[nid] => Array
(
[entity_type] => node
[entity] => stdClass Object
(
[vid] => 878
[uid] => 0
[title] => ...
[log] =>
[status] => 1
[comment] => 0
[promote] => 0
[sticky] => 0
[nid] => 568
[type] => event
[language] => und
[created] => 1329332968
[changed] => 1331836509
[tnid] => 0
[translate] => 0
[revision_timestamp] => 1331836509
[revision_uid] => 1
[body] => Array
(
[und] => Array
(
[0] => Array
(
[value] => ...
[summary] => ...
[safe_summary] => ...
)
)
)
[field_resident_company] => Array ( [und] => Array ( [0] => Array ( [tid] => 3 ) ) )
[field_series] => Array ( [und] => Array ( [0] => Array ( [tid] => 36 ) ) )
[field_venue] => Array ( )
[field_rotator_image] => Array ( )
[field_exclude] => Array ( [und] => Array ( [0] => Array ( [value] => 0 ) ) )
[field_performance_image] => Array ( )
[field_premiere] => Array ( [und] => Array ( [0] => Array ( [value] => 1330714800 [timezone] => UTC [timezone_db] => UTC [date_type] => datestamp ) ) )
[field_closing] => Array ( [und] => Array ( [0] => Array ( [value] => 1330714800 [timezone] => UTC [timezone_db] => UTC [date_type] => datestamp ) ) )
[field_exclude_update] => Array ( [und] => Array ( [0] => Array ( [value] => 0 ) ) )
[field_performance_date] => Array ( [und] => Array ( [0] => Array ( [value] => 2012-03-02 19:00:00 [timezone] => UTC [timezone_db] => UTC [date_type] => datetime ) ) )
[field_performance_id] => Array ( [und] => Array ( [0] => Array ( [value] => 1436 [format] => [safe_value] => 1436 ) ) ) [field_event_status] => Array ( [und] => Array ( [0] => Array ( [value] => open ) ) )
[field_calendar_title] => Array ( [und] => Array ( [0] => Array ( [value] => PSYCHIC EXP [format] => [safe_value] => PSYCHIC EXP ) ) )
...
)
)