Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Date 向drupal 7中附加到节点的日期字段添加数据_Date_Drupal 7_Data Migration_Drupal Field Api - Fatal编程技术网

Date 向drupal 7中附加到节点的日期字段添加数据

Date 向drupal 7中附加到节点的日期字段添加数据,date,drupal-7,data-migration,drupal-field-api,Date,Drupal 7,Data Migration,Drupal Field Api,我需要向Drupal7中的datetime字段添加数据。我正在尝试使用 $node->field_test_a_updated[0]['value'] = $val; $node->field_test_a_updated[0]['delta'] = 0; $node->field_test_a_updated[0]['timezone'] = 'UTC'; $node->field_test_a_updated[0]['timezone_db'] = 'UTC'; $n

我需要向Drupal7中的datetime字段添加数据。我正在尝试使用

$node->field_test_a_updated[0]['value'] = $val;
$node->field_test_a_updated[0]['delta'] = 0;
$node->field_test_a_updated[0]['timezone'] = 'UTC';
$node->field_test_a_updated[0]['timezone_db'] = 'UTC';
$node->field_test_a_updated[0]['date_type'] = 'datetime';
其中,$val的值为2010-06-15T00:00:00-00:00

当我尝试导入内容时,附加到节点的所有其他字段都会正确迁移,日期字段除外。我还尝试使用[LANGUAGE_NONE]选项

我确信我遗漏了一些与drupal7字段api相关的内容


请提供帮助。

在此上下文中,Drupal 7中的字段结构是:

array(
  'language_code' => array(
    0 => array(
      'value => $val,
      'other_column_value' => $other_val
    )
  )
);
delta由$array['language_code']中每个数组的键处理,因此不需要包含它。在本例中,您希望代码如下所示,假设您正在通过node_save传递节点:

$node->field_test_a_updated[LANGUAGE_NONE] = array(
  0 => array(
    'value' => $val,
    'timezone' => 'UTC',
    'timezone_db' => 'UTC',
    'date_type' => 'datetime'
  )
);
希望有帮助