function theme_user_badges_products_list_form in User Badges 6
Same name and namespace in other branches
- 6.2 user_badges_products.module \theme_user_badges_products_list_form()
Theme the badge list form.
Parameters
$form: An associative array containing the structure of the form.
File
- ./
user_badges_products.module, line 147 - @brief User Badges Product module file
Code
function theme_user_badges_products_list_form($form) {
//Loop through the array items in the name array to get all the bids for our listed badges
if (isset($form['newbadge']) && is_array($form['newbadge'])) {
foreach (element_children($form['newbadge']) as $key) {
//We only want nids as values of $key
if (!is_numeric($key)) {
continue;
}
//Create the rows array for the table theme
$row = array();
$row[] = drupal_render($form['name'][$key]);
$row[] = drupal_render($form['badge'][$key]);
$row[] = drupal_render($form['clear']['clear' . $key]);
$row[] = drupal_render($form['newbadge'][$key]);
$rows[] = $row;
}
//Add the submit button
$row = array();
$row[] = '';
$row[] = '';
$row[] = '';
$row[] = drupal_render($form['submit']);
$rows[] = $row;
}
else {
$rows[] = array(
array(
'data' => t('No products available.'),
'colspan' => '4',
),
);
}
//Theme all that we have processed so far into a table
$output .= theme('table', $form['header']['#value'], $rows);
//Create the table's pager
if ($form['pager']['#value']) {
$output .= drupal_render($form['pager']);
}
//Render any remaining form elements
$output .= drupal_render($form);
return $output;
}