function theme_uc_object_attributes_form in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_attribute/uc_attribute.module \theme_uc_object_attributes_form()
- 7.3 uc_attribute/uc_attribute.admin.inc \theme_uc_object_attributes_form()
Displays the formatted attribute form.
See also
File
- uc_attribute/
uc_attribute.admin.inc, line 798 - Attribute administration menu items.
Code
function theme_uc_object_attributes_form($form) {
$output = '';
if ($form['view']['#value'] == 'overview') {
$header = array(
t('Remove'),
t('Name'),
t('Label'),
t('Default'),
t('Required'),
t('List position'),
t('Display'),
);
if (count(element_children($form['attributes'])) > 0) {
foreach (element_children($form['attributes']) as $aid) {
$row = array(
drupal_render($form['attributes'][$aid]['remove']),
drupal_render($form['attributes'][$aid]['name']),
drupal_render($form['attributes'][$aid]['label']),
drupal_render($form['attributes'][$aid]['option']),
drupal_render($form['attributes'][$aid]['required']),
drupal_render($form['attributes'][$aid]['ordering']),
drupal_render($form['attributes'][$aid]['display']),
);
$rows[] = array(
'data' => $row,
'class' => 'draggable',
);
}
}
else {
$rows[] = array(
array(
'data' => t('You must first <a href="!url">add attributes to this !type</a>.', array(
'!url' => request_uri() . '/add',
'!type' => $form['type']['#value'],
)),
'colspan' => 6,
),
);
}
drupal_add_tabledrag('uc-attribute-table', 'order', 'sibling', 'uc-attribute-table-ordering');
$output = theme('table', $header, $rows, array(
'id' => 'uc-attribute-table',
));
}
else {
$output = '<div class="uc-attributes-add-link">';
$output .= t('You may add more attributes <a href="!url">here</a>.', array(
'!url' => url('admin/store/attributes/add'),
));
$output .= '</div>';
}
$output .= drupal_render($form);
return $output;
}