function photos_swfu_form_alter in Album Photos 7.3
Same name and namespace in other branches
- 6.2 photos_swfu/photos_swfu.module \photos_swfu_form_alter()
Implements hook_form_alter().
File
- photos_swfu/
photos_swfu.module, line 39
Code
function photos_swfu_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == "photos_upload_form") {
if (isset($form['new']['pid']['#value']) && is_numeric($form['new']['pid']['#value'])) {
$pid = $form['new']['pid']['#value'];
}
elseif (isset($_GET['pid'])) {
$pid = $_GET['pid'];
}
$swfu_switch = isset($_SESSION['photos_swfu_switch']) ? $_SESSION['photos_swfu_switch'] : 0;
if ($swfu_switch != 1) {
if (isset($form['new']['pid']['#value']) && !($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]);
}
}
$pid = isset($pid) ? $pid : 0;
$nid = !empty($nid) ? $nid : $pid;
$form['new'] += photos_swfu_form($pid, $nid);
}
}