function photos_form_alter in Album Photos 6.2
Same name and namespace in other branches
- 8.5 photos.module \photos_form_alter()
- 8.4 photos.module \photos_form_alter()
- 7.3 photos.module \photos_form_alter()
- 6.0.x photos.module \photos_form_alter()
File
- ./
photos.module, line 575
Code
function photos_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'node_type_form' && isset($form['identity']['type']) && arg(3) != 'photos') {
$form['photos'] = array(
'#type' => 'fieldset',
'#title' => t('Sub-Album settings'),
'#collapsible' => TRUE,
'#collapsed' => true,
);
$form['photos']['photos_node'] = array(
'#type' => 'radios',
'#title' => t('Sub-Album'),
'#default_value' => variable_get('photos_node_' . $form['#node_type']->type, 0),
'#options' => array(
t('Disabled'),
t('Enabled'),
),
'#description' => t('Node will become a sub-album, you can upload images to the node.'),
);
$form['photos']['photos_share'] = array(
'#type' => 'radios',
'#title' => t('Reference'),
'#default_value' => variable_get('photos_share_' . $form['#node_type']->type, 1),
'#options' => array(
t('Disabled'),
t('Enabled'),
),
'#description' => t('After enable this, you can insert a reference of images from other albums to the node, but do not attach the image to the node.'),
);
}
if ($form_id == 'comment_form' && variable_get('photos_comment', 0)) {
if (arg(0) == 'photos' && is_numeric(arg(2))) {
$fid = arg(2);
}
else {
if (arg(1) == 'reply' && is_numeric(arg(3))) {
$fid = db_result(db_query('SELECT fid FROM {x_vote} WHERE cid = %d', arg(3)));
}
}
$form['photos_fid'] = array(
'#type' => 'hidden',
'#default_value' => $fid,
);
$form['#submit'] = array(
'photos_comment_form_submit',
);
}
if (isset($form['type']) && isset($form['#node']) && user_access('view photo')) {
$node = $form['#node'];
if (variable_get('photos_share_' . $node->type, 0)) {
$form['photos_share'] = array(
'#title' => t('Insert image'),
'#weight' => 0,
'#type' => 'fieldset',
'#collapsible' => TRUE,
);
$form['photos_share']['share']['#value'] = '<div id="potos-thickbox">' . l(t('Insert an existing image'), 'photos/share', array(
'query' => 'KeepThis=true&TB_iframe=true&height=450&width=650',
'attributes' => array(
'title' => t('Choose an image from my albums to insert into the node'),
'class' => 'thickbox',
),
)) . '(' . l(t('Open a new window'), 'photos/share', array(
'attributes' => array(
'title' => t('Choose an image from my albums to insert into the node'),
'target' => '_blank',
),
)) . ')</div>';
}
}
}