gpt4 book ai didi

php - 自定义表单中的 Drupal Imagfield/Filefield

转载 作者:可可西里 更新时间:2023-11-01 01:10:29 26 4
gpt4 key购买 nike

我已经创建了一个模块,其中包含这个功能:

<?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'];
}
?>

是否可以在表单中插入 CCK 文件字段/图像字段?如果可以,我该怎么做?

Drupal 版本 6.15

问候,
约尔

最佳答案

关于php - 自定义表单中的 Drupal Imagfield/Filefield,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2387305/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com