function theme_commerce_pricing_attributes_details in Commerce Pricing Attributes 7
Theme function of set_details sortable table.
1 theme call to theme_commerce_pricing_attributes_details()
- commerce_pricing_attributes_default_setting_form in ./
commerce_pricing_attributes.admin.inc - Administatiorn settings form.
File
- ./
commerce_pricing_attributes.module, line 717
Code
function theme_commerce_pricing_attributes_details($variables) {
$output = '';
$rows = array();
$i = 0;
$display_default = isset($variables['element']['#display_default']) ? $variables['element']['#display_default'] : TRUE;
foreach (element_children($variables['element']) as $item) {
$cells = array(
render($variables['element'][$item]['enabled']),
render($variables['element'][$item]['default']),
render($variables['element'][$item]['price_op']) . render($variables['element'][$item]['price']) . render($variables['element'][$item]['currency_code']) . render($variables['element'][$item]['calculate']),
render($variables['element'][$item]['weight']),
);
if (!$display_default) {
unset($cells[1]);
}
$rows[$i] = array(
'data' => $cells,
'class' => array(),
'weight' => $variables['element'][$item]['weight']['#default_value'],
);
if ($item !== '_none') {
$rows[$i]['class'][] = 'draggable';
}
else {
$rows[$i]['weight'] = -999999;
}
$i++;
}
uasort($rows, 'drupal_sort_weight');
$header = array(
t('Default'),
t('Price Calculation'),
'',
);
if (!$display_default) {
unset($header[1]);
}
// Support for table select all/none.
drupal_add_js('misc/tableselect.js');
array_unshift($header, array(
'class' => array(
'select-all',
),
'data' => t('Options'),
));
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => $variables['element']['#id'] . '-table',
),
));
drupal_add_tabledrag($variables['element']['#id'] . '-table', 'order', 'sibling', 'commerce-pricing-attributes-set-details-options-weight');
return $output;
}