function theme_imagepicker_browse_admin_form in Image Picker 6.2
Same name and namespace in other branches
- 7 imagepicker.module \theme_imagepicker_browse_admin_form()
File
- ./
imagepicker.module, line 1791 - Enables permitted roles to upload images for insertion into configured nodes.
Code
function theme_imagepicker_browse_admin_form($form) {
$src = $form['options']['src']['#value'];
$cols = $form['options']['cols']['#value'];
$public = $form['options']['public']['#value'];
$form['options']['#prefix'] = '<div class="container-inline">';
$form['options']['#suffix'] = '</div>';
// tablesort
if ($public && $src == 'admin') {
$header = array(
theme('table_select_header_cell'),
array(
'data' => t('Name'),
'field' => 'i.img_name',
),
array(
'data' => t('Title'),
'field' => 'i.img_title',
),
t('Description'),
array(
'data' => t('User'),
'field' => 'n.name',
),
array(
'data' => t('Date'),
'field' => 'i.img_date',
),
array(
'data' => t('Actions'),
'colspan' => 2,
),
);
}
else {
$header = array(
theme('table_select_header_cell'),
array(
'data' => t('Name'),
'field' => 'i.img_name',
),
array(
'data' => t('Title'),
'field' => 'i.img_title',
),
t('Description'),
array(
'data' => t('Date'),
'field' => 'i.img_date',
),
array(
'data' => t('Actions'),
'colspan' => 2,
),
);
}
$output = drupal_render($form['options']);
if (isset($form['img_name']) && is_array($form['img_name'])) {
foreach (element_children($form['img_name']) as $key) {
if ($public && $src == 'admin') {
$rows[] = array(
drupal_render($form['images'][$key]),
drupal_render($form['img_name'][$key]),
drupal_render($form['img_title'][$key]),
drupal_render($form['img_desc'][$key]),
drupal_render($form['img_list'][$key]),
drupal_render($form['img_date'][$key]),
drupal_render($form['img_edit'][$key]),
drupal_render($form['img_delete'][$key]),
);
}
else {
$rows[] = array(
drupal_render($form['images'][$key]),
drupal_render($form['img_name'][$key]),
drupal_render($form['img_title'][$key]),
drupal_render($form['img_desc'][$key]),
drupal_render($form['img_date'][$key]),
drupal_render($form['img_edit'][$key]),
drupal_render($form['img_delete'][$key]),
);
}
}
}
else {
$rows[] = array(
array(
'data' => t('No images available.'),
'colspan' => $cols,
),
);
}
if ($form['pager']['#value']) {
$pager = drupal_render($form['pager']);
$rows[] = array(
array(
'data' => $pager,
'colspan' => $cols + 1,
),
);
}
$output .= theme('table', $header, $rows);
$output .= drupal_render($form);
return $output;
}