You are here

function image_form in Image 5.2

Same name and namespace in other branches
  1. 5 image.module \image_form()
  2. 6 image.module \image_form()

Implementation of hook_form

File

./image.module, line 546

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,
  );
  $form['images']['#tree'] = TRUE;
  foreach (image_get_sizes() as $key => $size) {
    $form['images'][$key] = array(
      '#type' => 'value',
      '#value' => $node->images[$key],
    );
  }
  $form['thumbnail'] = array(
    '#type' => 'item',
    '#weight' => -10,
    '#after_build' => array(
      'image_form_add_thumbnail',
    ),
  );
  $form['rebuild_images'] = array(
    '#type' => 'checkbox',
    '#title' => t('Rebuild derivative images'),
    '#default_value' => FALSE,
    '#description' => t('Check this to rebuild the derivative images for this node.'),
  );
  $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;
}