jQuery Image Picker integration
Component ID
2069985
Component name
jQuery Image Picker integration
Component type
module
Maintenance status
Development status
Component security advisory coverage
covered
Downloads
813
Component created
Component changed
Component body
Description
This project is aimed to provide integration for developers of jQuery Image Picker as a form element.
Example
/**
* Page callback: delete photos
*/
function photos_delete_form() {
global $user;
$form['photos'] = array(
'#type' => 'imagepicker',
'#multiple' => TRUE,
);
$results = db_select('photos', 'p')
->fields('p')
->orderBy('timestamp', 'DESC')
->execute()
->fetchAllAssoc('id');
foreach ($results as $photo) {
$form['photos']['#options'][$photo->id] = array(
'#value' => $photo->id,
'#data-img-src' => _photos_build_photo_url($photo)
);
}
return confirm_form($form, NULL, 'photos', NULL, t('Delete'));
}
function photos_delete_form_submit($form, $form_state) {
if ($form_state['values']['photos']) {
entity_delete_multiple('photo', $form_state['values']['photos']);
drupal_set_message(t('Successfully deleted @count photos', array(
'@count' => count($form_state['values']['photos']),
)));
}
}
