You are here

function gallery_assist_items_form in Gallery Assist 7

Same name in this branch
  1. 7 gallery_assist_form_BUP.inc \gallery_assist_items_form()
  2. 7 gallery_assist_form.inc \gallery_assist_items_form()

Form builder; GA items data form.

@todo: Theme as table to a better overview.

Parameters

$node: Object containing the node object.

See also

gallery_assist_items_form_submit()

1 call to gallery_assist_items_form()
gallery_assist_gallery_node_form in ./gallery_assist.module
Form builder; GA settings node form builder.

File

./gallery_assist_form.inc, line 249
GA node settings, upload, sorting and gallery items management forms.

Code

function gallery_assist_items_form($node) {
  $form = array(
    '#theme' => 'gallery_assist_items_form',
  );
  $form['pager_top'] = array(
    '#markup' => theme('pager', array(
      'tags' => NULL,
    )),
    '#weight' => -50,
  );
  $form['gallery_items'] = array(
    '#tree' => TRUE,
  );
  foreach ($node->ga_items as $item) {
    $variables = array(
      'path' => $item->opath,
      'alt' => $item->palt,
      'title' => $item->ptitle,
      'getsize' => FALSE,
      'style_name' => 'gallery_default_icon_75',
      'attributes' => array(
        'id' => $node->nid . '-' . $item->weight,
      ),
    );
    if (isset($item->info['top'])) {
      $variables['attributes']['style'] = 'margin-top:' . $item->info['top'] . 'px;';
    }
    $image = theme('image_style', $variables);

    //    $image = gallery_assist_thumbnail_link($node, $item, $image);
    $form['gallery_items'][$item->pid]['fid'] = array(
      '#type' => 'hidden',
      '#value' => $item->fid,
    );
    $form['gallery_items'][$item->pid]['pid'] = array(
      '#type' => 'hidden',
      '#value' => $item->pid,
    );
    $form['gallery_items'][$item->pid]['delete'] = array(
      '#type' => 'checkbox',
      '#title' => 'delete',
    );
    $form['gallery_items'][$item->pid]['image'] = array(
      '#markup' => $image,
    );
    $form['gallery_items'][$item->pid]['ptitle'] = array(
      '#type' => 'textfield',
      '#title' => 'Imagetitle',
      '#default_value' => $item->ptitle,
    );
    $form['gallery_items'][$item->pid]['palt'] = array(
      '#type' => 'textfield',
      '#title' => 'Image alt info',
      '#default_value' => $item->palt,
    );
    $form['gallery_items'][$item->pid]['pdescription'] = array(
      '#type' => 'textarea',
      '#title' => 'Image description',
      '#default_value' => $item->pdescription,
    );
    $form['gallery_items'][$item->pid]['cover'] = array(
      '#type' => 'radio',
      '#name' => "coverimage[{$item->pid}]",
      '#attributes' => array(
        'class' => array(
          'coverimage',
        ),
      ),
      '#return_value' => $item->cover == 1 ? $item->pid : false,
      '#default_value' => $item->cover == 1 ? $item->pid : false,
    );
  }
  $form['gallcount'] = array(
    '#type' => 'hidden',
    '#value' => $node->ga_count,
  );

  //  dsm($node);
  $form['pager_bottom'] = array(
    '#markup' => theme('pager', array(
      'tags' => NULL,
    )),
    '#weight' => 50,
  );
  return $form;
}