function theme_uc_object_options_form in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_attribute/uc_attribute.admin.inc \theme_uc_object_options_form()
- 7.3 uc_attribute/uc_attribute.admin.inc \theme_uc_object_options_form()
Display the option form.
File
- uc_attribute/
uc_attribute.module, line 1058
Code
function theme_uc_object_options_form($form) {
$header = array(
t('Attribute'),
t('Options'),
t('Default'),
t('Cost'),
t('Price'),
t('Weight'),
t('Order'),
);
foreach (element_children($form['attributes']) as $key) {
$row = array();
$row[] = array(
'data' => drupal_render($form['attributes'][$key]['aid']) . drupal_render($form['attributes'][$key]['name']),
'class' => 'attribute',
);
if (element_children($form['attributes'][$key]['default'])) {
$first = TRUE;
foreach (element_children($form['attributes'][$key]['default']) as $oid) {
$row[] = drupal_render($form['attributes'][$key]['options'][$oid]['select']);
$row[] = drupal_render($form['attributes'][$key]['default'][$oid]);
$row[] = drupal_render($form['attributes'][$key]['options'][$oid]['cost']);
$row[] = drupal_render($form['attributes'][$key]['options'][$oid]['price']);
$row[] = drupal_render($form['attributes'][$key]['options'][$oid]['weight']);
$row[] = drupal_render($form['attributes'][$key]['options'][$oid]['ordering']);
if (!$first) {
$row = array_pad($row, -7, '');
}
else {
$first = FALSE;
}
$rows[] = $row;
$row = array();
}
unset($form['attributes'][$key]['default']);
}
else {
$row[] = array(
'data' => drupal_render($form['attributes'][$key]['default']),
'colspan' => 7,
);
$rows[] = $row;
}
$rows[] = array(
array(
'data' => '<hr />',
'colspan' => 7,
),
);
}
if (count($rows) == 0) {
$rows[] = array(
array(
'data' => t('This !type does not have any attributes.', array(
'!type' => $form['type']['#value'] == 'product' ? t('product') : t('product class'),
)),
'colspan' => 7,
),
);
}
$output = theme('table', $header, $rows, array(
'class' => 'product_attributes',
)) . drupal_render($form);
return $output;
}