function theme_commerce_price_formatted_components in Commerce Core 7
Themes a price components table.
Parameters
$variables: Includes the 'components' array and original 'price' array.
1 theme call to theme_commerce_price_formatted_components()
- commerce_price_field_formatter_view in modules/
price/ commerce_price.module - Implements hook_field_formatter_view().
File
- modules/
price/ commerce_price.module, line 535 - Defines the Price field with widgets and formatters used to add prices with currency codes to various Commerce entities.
Code
function theme_commerce_price_formatted_components($variables) {
// Add the CSS styling to the table.
drupal_add_css(drupal_get_path('module', 'commerce_price') . '/theme/commerce_price.theme.css');
// Build table rows out of the components.
$rows = array();
foreach ($variables['components'] as $name => $component) {
$rows[] = array(
'data' => array(
array(
'data' => $component['title'],
'class' => array(
'component-title',
),
),
array(
'data' => $component['formatted_price'],
'class' => array(
'component-total',
),
),
),
'class' => array(
drupal_html_class('component-type-' . $name),
),
);
}
return theme('table', array(
'rows' => $rows,
'attributes' => array(
'class' => array(
'commerce-price-formatted-components',
),
),
));
}