dongyinzheng6572 2010-03-05 14:21
浏览 63
已采纳

自定义形式的Drupal Imagfield / Filefield

i have created a module with this among others this function in it:

<?php
function ils_ladda_upp_form() {
    $form['upload'] = array(
        '#method' => 'post',
        '#attributes' => array(
            'enctype' => 'multipart/form-data',
        )
    );
    $form['upload']['album_name'] = array(
        '#type' => 'textfield',
        '#title' => t('Albumnamn'),
        '#required' => 1
    );
    $form['upload']['album_location'] = array(
        '#type' => 'textfield',
        '#title' => t('Plats'),
    );
    $form['upload']['album_date'] = array(
        '#type' => 'date',
        '#title' => t('Datum'),
        '#required' => 1,
        '#suffix' => '(då bilderna togs)'
    );
    $form['upload']['album_description'] = array(
        '#type' => 'textarea',
        '#title' => t('Beskrivning'),
        '#resizable' => false,
    );
    $form['upload']['school'] = array(
        '#type' => 'hierarchical_select',
        '#title' => t('Skola & Klass'),
        '#size' => 1,
        '#required' => 1,
        '#config' => array(
            'module' => 'hs_taxonomy',
            'params' => array(
            'vid' => 1,
            ),
            'save_lineage'    => 0,
            'enforce_deepest' => 0,
            'entity_count'    => 0,
            'require_entity'  => 0,
            'resizable'       => 0,
            'level_labels' => array(
            'status' => 0,
            'labels' => array(
                0 => t('Main category'),
                1 => t('Subcategory'),
                2 => t('Third level category'),
            ),
        ),
            'dropbox' => array(
            'status'   => 0,
            'title'    => t('All selections'),
            'limit'    => 0,
            'reset_hs' => 1,
        ),
            'editability' => array(
            'status'           => 0,
            'item_types'       => array(),
            'allowed_levels'   => array(
            0 => 0,
            1 => 0,
            2 => 1,
            ),
            'allow_new_levels' => 0,
            'max_levels'       => 3,
        ),
            # These settings cannot be configured through the UI: they can only be
            # overridden through code.
            'animation_delay'    => 400,
            'special_items'      => array(),
            'render_flat_select' => 0,
            'path'               => 'hierarchical_select_json',
        ),
        #'#default_value' => '83',
    );
    $form['upload']['file'] = array(
        '#type' => 'file',
        '#title' => t('Bild'),
    );
    $form['upload']['name'] = array(
        '#type' => 'textfield',
        '#required' => true,
        '#title' => t('Ditt namn')
    );
    $form['upload']['submit'] = array('#type' => 'submit', '#value' => t('Ladda upp'));
    return $form['upload'];
}
?>

Is it possible to insert a CCK Filefield/imagefield in the form? If so, how do i do it?

Drupal v. 6.15

Regards,
Joar

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)