You are here

function set_image_form_default_values in Node Gallery 6

Same name and namespace in other branches
  1. 6.2 node_gallery.pages.inc \set_image_form_default_values()
1 call to set_image_form_default_values()
node_gallery_image_item_edit_form in ./node_gallery.pages.inc

File

./node_gallery.pages.inc, line 336
Node gallery pages.

Code

function set_image_form_default_values(&$form, $image, $config) {
  global $user;
  $form['title']['#default_value'] = empty($form['title']['#default_value']) ? $image->filename : $form['title']['#default_value'];
  if (!empty($form['body_field'])) {
    $tmp_item = $form['body_field']['body'];
    unset($form['body_field']);
    $form['body'] = $tmp_item;
    $form['body']['#rows'] = 3;
    $form['body']['#default_value'] = empty($form['body']['#default_value']) ? $image->filename : $form['body']['#default_value'];
  }
  if (!empty($form['changed']) && empty($form['changed']['#value'])) {
    $form['changed']['#value'] = time();
  }
  if (user_access('administer nodes')) {
    $form['name'] = array(
      '#type' => 'value',
      '#value' => $user->name,
    );
  }
  if (!empty($form['uid']) && empty($form['uid']['#value'])) {
    $form['uid']['#value'] = $user->uid;
  }
  $form['comment'] = array(
    '#type' => 'value',
    '#value' => $config->image_comment,
  );
}