Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.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
Drupal 7删除多个imagefields表单_Drupal_Drupal 7_Widget_Imagefield - Fatal编程技术网

Drupal 7删除多个imagefields表单

Drupal 7删除多个imagefields表单,drupal,drupal-7,widget,imagefield,Drupal,Drupal 7,Widget,Imagefield,我正在构建一个Drupal7(7.20)网站,其“项目”内容类型包含多个图像字段(我不想使用图库) 我希望能够从节点编辑页面对这些字段执行批量删除操作。根据我收集到的信息,我必须重写theme\u file\u widget\u multiple并返回一个tableselect而不是一个table,然后使用一个按钮加上javascript从数据库中删除图像 我错过了什么明显的东西吗?对于如此琐碎的事情,这似乎需要做很多工作 编辑: 我在这方面取得了一些进展: function mytheme_f

我正在构建一个Drupal7(7.20)网站,其“项目”内容类型包含多个图像字段(我不想使用图库)

我希望能够从节点编辑页面对这些字段执行批量删除操作。根据我收集到的信息,我必须重写theme\u file\u widget\u multiple并返回一个tableselect而不是一个table,然后使用一个按钮加上javascript从数据库中删除图像

我错过了什么明显的东西吗?对于如此琐碎的事情,这似乎需要做很多工作

编辑:

我在这方面取得了一些进展:

function mytheme_file_widget_multiple($variables) {

$element = $variables ['element'];
$headers = array ();
$headers ['info'] = t ( '' );

$widgets = array ();
foreach ( element_children ( $element ) as $key ) {
    $widgets [] = &$element [$key];
}
usort ( $widgets, '_field_sort_items_value_helper' );

$rows [] = array ();
$i = 0;
foreach ( $widgets as $key => &$widget ) {
    // Save the uploading row for last.
    if ($widget ['#file'] == FALSE) {
        $widget ['#description'] = $element ['#file_upload_description'];
        continue;
    }
    $operations_elements = array ();
    foreach ( element_children ( $widget ) as $sub_key ) {
        if (isset ( $widget [$sub_key] ['#type'] ) && $widget [$sub_key] ['#type'] == 'submit') {
            $operations_elements [] = &$widget [$sub_key];
        }
    }
    $information = drupal_render ( $widget );
    $rows [$i ++] ['info'] = $information;
}

$output = '';
$output = drupal_render_children ( $element );
$form ['element'] = array (
    '#type' => 'tableselect',
    '#header' => $headers,
    '#options' => $rows,
    '#js_select' => TRUE,
    '#empty' => t ( 'No data' ),
    '#attributes' => array () );
$output .= empty ( $rows ) ? "" : drupal_render ( $form );
return $output;
}
这包含在我的主题的模板文件中,但是tableselect没有复选框。这快把我逼疯了。。有人能告诉我我做错了什么吗

根据我收集的信息,我必须创建一个覆盖fieldset预处理函数的模块

以下是参考资料:

(一)

这篇文章似乎试图做你想做的事

2) 也请查看 这可能有用

3) 如果没有,则需要制作自己的小部件:

(有您需要的所有示例)

祝你一切顺利