function image_form in Image 5
Same name and namespace in other branches
- 5.2 image.module \image_form()
- 6 image.module \image_form()
Implementation of hook_form
File
- ./
image.module, line 493
Code
function image_form(&$node, &$param) {
_image_check_settings();
$type = node_get_types('type', $node);
$form['title'] = array(
'#type' => 'textfield',
'#title' => check_plain($type->title_label),
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#default_value' => $node->title,
);
if ($node->new_file) {
$form['new_file'] = array(
'#type' => 'value',
'#value' => TRUE,
);
}
$form['images']['#tree'] = TRUE;
foreach (image_get_sizes() as $key => $size) {
if ($node->new_file) {
$form['images'][$key] = array(
'#type' => 'hidden',
'#value' => $node->images[$key],
);
}
else {
$form['images'][$key] = array(
'#type' => 'hidden',
'#default_value' => $node->images[$key],
);
}
}
$form['thumbnail']['#after_build'][] = 'image_form_add_thumbnail';
$form['#attributes'] = array(
"enctype" => "multipart/form-data",
);
$form['image'] = array(
'#type' => 'file',
'#title' => t('Image'),
'#size' => 40,
'#description' => t('Click "Browse..." to select an image to upload.'),
'#weight' => -3,
);
if ($type->has_body) {
$form['body_filter']['body'] = array(
'#type' => 'textarea',
'#title' => check_plain($type->body_label),
'#required' => $type->min_word_count > 0,
'#default_value' => $node->body,
);
$form['body_filter']['format'] = filter_form($node->format);
}
return $form;
}