【发布时间】:2014-07-26 08:14:44
【问题描述】:
我正在尝试使用表单 API 在我的 Drupal 7 自定义模块中使用 Multiupload Imagefield Widget... 但它不起作用:(
当我按下“上传”按钮时,悸动者会出现一秒钟,然后什么都没有发生,只是刷新页面。谁能告诉我我做错了什么?
我的模块表单功能:
<?php
function test_module_form($form, &$form_state) {
$form = array();
$form['image'] = array(
'#title' => 'Upload image',
'#type' => 'mfw_managed_file',
'#upload_location' => 'public://images/',
'#upload_validators' => array(
'file_validate_is_image' => array(),
'file_validate_extensions' => array('png gif jpg jpeg'),
'file_validate_size' => array(2 * 1024 * 1024),
),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}
?>
我使用全新安装:
- Drupal 7.30
- 多上传文件字段小部件 7.x-1.13
- Multiupload Imagefield Widget 7.x-1.3
小部件在节点编辑表单中开箱即用,但在自定义模块中却不行。 请帮忙。谢谢。
【问题讨论】:
标签: drupal drupal-7 filefield imagefield form-api