function theme_node_gallery_api_manage_items_form in Node Gallery 7
Theme function for Manage Items form.
1 theme call to theme_node_gallery_api_manage_items_form()
- node_gallery_api_manage_items_form in ./
node_gallery_api.pages.inc - Displays the content for our "Manage Images" tab, which is a VBO view.
File
- theme/
theme.inc, line 11 - Node gallery theme functions
Code
function theme_node_gallery_api_manage_items_form($variables) {
$form = $variables['form'];
if (empty($form['items'])) {
return t('This gallery is empty.');
}
// Pull in the multi-select functionality from core.
drupal_add_js('misc/tableselect.js');
// Get fieldname to retrieve the filepath for the thumbnail without
// loading the node.
$relationship_type = node_gallery_api_get_relationship_type($form['#gallery']->type);
$enable_rotation = FALSE;
if ($relationship_type->settings['manage_items']['enable_rotation'] && (image_get_toolkit() != 'gd' || function_exists("imagerotate"))) {
$enable_rotation = TRUE;
drupal_add_library('system', 'ui.dialog');
drupal_add_library('system', 'ui.draggable');
drupal_add_library('system', 'ui.resizable');
drupal_add_js(drupal_get_path('module', 'node_gallery') . '/js/ng_manage_images.js');
}
$header = array(
array(
'data' => t('Delete'),
'class' => 'select-all',
),
t('Preview'),
t('Edit'),
t('Cover'),
);
if ($enable_rotation) {
$header = array(
array(
'data' => t('Delete'),
'class' => 'select-all',
),
t('Preview'),
t('Edit'),
t('Rotation'),
t('Cover'),
);
}
$rows = array();
foreach (element_children($form['items']) as $nid) {
$element =& $form['items'][$nid];
$row = array();
$row[] = drupal_render($element['remove']);
$file = $element['item_file']['#value'];
if (!empty($file)) {
$file_object = (object) $file;
$file_view = file_view($file_object, 'node_gallery_api_admin_thumbnail');
$row[] = drupal_render($file_view);
}
else {
$row[] = '';
}
$edit = drupal_render($element['edit_form']);
if (!empty($element['ngid'])) {
$edit .= drupal_render($element['ngid']);
}
$row[] = $edit;
if ($enable_rotation && !empty($file) && $file['type'] == 'image') {
$row[] = drupal_render($element['rotate']);
}
elseif ($enable_rotation) {
drupal_render($element['rotate']);
$row[] = '';
}
if ($form['is_cover']) {
$row[] = drupal_render($form['is_cover'][$nid]);
}
$rows[] = array(
'data' => $row,
);
}
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'upload-attachments',
),
));
$output .= theme('pager');
$output .= drupal_render_children($form);
return $output;
}