Я переопределяю шаблон поля для одного из моих представлений и хочу получить доступ к другому значению поля из переменной $ row. Документация по файлу шаблона показывает это:
При извлечении выходных данных из $ row следует использовать эту конструкцию: $ data = $ row -> {$ field-> field_alias}
Мое поле называется field_calendar_title, но следующее не работает должным образом:
$row->{$field->field_calendar_title}
Я получаю следующую ошибку:
Неустранимая ошибка: невозможно получить доступ к пустому свойству ...
Отличается ли поле «псевдоним» от имени поля в типе содержимого?
«Очищенный» вывод из 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 ) ) )
...
)
)