Drupal 7字段集合中的计算字段

时间:2013-11-28 13:40:54

标签: drupal-7 timestamp computed-field drupal-field-collection

我有一个包含2个日期(时间戳)的字段集合,并希望计算日期之间的差异。但我无法让它发挥作用..有任何帮助吗?

Computed code:
$eind = $entity_field->field_data_field_eind_field_collection_item_entity_type[0]'timestamp'];
$begin = $entity_field->field_data_field_begin_field_collection_item_entity_type[0]['timestamp'];
$entity_field[0]['value'] = $eind - $begin;

Display code:
$display_output = $entity_field[0]['value'];

1 个答案:

答案 0 :(得分:0)

错过[

上的['timestamp']
$eind = $entity_field->field_data_field_eind_field_collection_item_entity_type[0]['timestamp']; // missing the [ here