function imagepicker_image_form in Image Picker 6.2
Same name and namespace in other branches
- 5.2 imagepicker.module \imagepicker_image_form()
- 5 imagepicker.module \imagepicker_image_form()
- 7 imagepicker.functions.inc \imagepicker_image_form()
Function to display the image insertion form
Parameters
$img_id: The id of the image to be inserted.
$public: Optional, ensures that public images cannot be edited.
Return value
Returns the image form.
1 string reference to 'imagepicker_image_form'
File
- ./
imagepicker.functions.inc, line 71 - Imagepicker functions
Code
function imagepicker_image_form($form_state, $img_id, $public = FALSE) {
global $user;
if (variable_get('imagepicker_default_align_show', 1)) {
$form['align'] = imagepicker_get_align_opts(isset($user->imagepicker_insert_defaults_align) ? $user->imagepicker_insert_defaults_align : variable_get('imagepicker_insert_defaults_align', 'none'));
}
$form['show'] = imagepicker_get_show_opts(isset($user->imagepicker_insert_defaults_show) ? $user->imagepicker_insert_defaults_show : variable_get('imagepicker_insert_defaults_show', 'full'));
$form['link'] = imagepicker_get_link_opts(isset($user->imagepicker_insert_defaults_link) ? $user->imagepicker_insert_defaults_link : variable_get('imagepicker_insert_defaults_link', 'none'));
if (module_exists('imagecache') && variable_get('imagepicker_imagecache_enable', 0)) {
$presets = imagecache_presets();
$opts = array(
'' => t('None'),
);
if (count($presets)) {
foreach ($presets as $preset) {
$opts[$preset['presetname']] = $preset['presetname'];
}
$form['presets_show'] = array(
'#type' => 'select',
'#title' => t('Presets for Show'),
'#options' => $opts,
'#default_value' => variable_get('imagepicker_imagecache_default_show', ''),
);
$form['presets_link'] = array(
'#type' => 'select',
'#title' => t('Presets for Link'),
'#options' => $opts,
'#default_value' => variable_get('imagepicker_imagecache_default_link', ''),
);
}
}
$form['desc'] = array(
'#type' => 'checkbox',
'#title' => t('Show Description'),
'#description' => t('Insert title and description'),
);
// allow override but only if admin allows
if (variable_get('imagepicker_use_cssbox', 0) && !isset($user->imagepicker_use_cssbox) || variable_get('imagepicker_use_cssbox', 0) && isset($user->imagepicker_use_cssbox) && $user->imagepicker_use_cssbox) {
$form['cssbox'] = array(
'#type' => 'textfield',
'#title' => t('Add additional css'),
'#size' => 20,
'#description' => t('You can add additional css here, eg. class="myclass". This will be inserted into the image tag'),
);
}
// rel
if (module_exists('colorbox') && variable_get('imagepicker_colorbox_enable', 0)) {
if (variable_get('imagepicker_use_relbox', 0) && !isset($user->imagepicker_use_relbox) || variable_get('imagepicker_use_relbox', 0) && isset($user->imagepicker_use_relbox) && $user->imagepicker_use_relbox) {
$form['relbox'] = array(
'#type' => 'textfield',
'#title' => t('Add rel attribute'),
'#size' => 20,
'#description' => t("You can add a rel tag here, it will be added to the link when Link 'Colorbox' is selected. Useful for creating galleries. No spaces."),
);
$form['linkhide'] = array(
'#type' => 'checkbox',
'#title' => t('Hide this link'),
'#description' => t('Use this on subsequent links added to a gallery.'),
);
}
}
// linkbox
if (variable_get('imagepicker_use_linkbox', 0) && !isset($user->imagepicker_use_linkbox) || variable_get('imagepicker_use_linkbox', 0) && isset($user->imagepicker_use_linkbox) && $user->imagepicker_use_linkbox) {
$form['linkbox'] = array(
'#type' => 'textfield',
'#title' => t('Edit Link'),
'#size' => 55,
'#description' => t("You can edit the link here. This only applies when Link 'Page' is selected."),
'#default_value' => '',
);
}
$form['insert'] = array(
'#type' => 'button',
'#value' => t('Insert image'),
'#attributes' => array(
'onclick' => 'imagepickerInsert(this); return false;',
),
);
if (!$public) {
$form['edit'] = array(
'#type' => 'submit',
'#value' => t('Edit image'),
'#submit' => array(
'imagepicker_image_form_edit',
),
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete image'),
'#submit' => array(
'imagepicker_image_form_delete',
),
);
}
$form['img_id'] = array(
'#type' => 'value',
'#value' => $img_id,
);
return $form;
}