You are here

function photos_swfu_form_alter in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos_swfu/photos_swfu.module \photos_swfu_form_alter()

File

photos_swfu/photos_swfu.module, line 28

Code

function photos_swfu_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == "photos_upload_form") {
    if ($_SESSION['photos_swfu_switch'] != 1) {
      if (!($pid = $form['new']['pid']['#value'])) {
        $nid = $form['new']['nid']['#value'];
        if (!($pid = $form['new']['pid']['#default_value'])) {
          if ($form['new']['pid']['#options'][0]->option) {
            $array = array_keys($form['new']['pid']['#options'][0]->option);
            $pid = $array[0];
          }
          else {
            return;
          }
        }
      }
      unset($form['date']);
      unset($form['new']['submit']);
      for ($i = 0; $i < variable_get('photos_num', 5); ++$i) {
        unset($form['new']['images_' . $i]);
        unset($form['new']['title_' . $i]);
        unset($form['new']['des_' . $i]);
      }
    }
    $form['new'] += photos_swfu_form($pid, $nid);
  }
}