function commerce_pricing_attributes_entity_view in Commerce Pricing Attributes 7
Implements hook_entity_view().
Wrap commerce_price elements with a div to achieve ajax refresh on attribute widget change.
File
- ./
commerce_pricing_attributes.module, line 1237
Code
function commerce_pricing_attributes_entity_view($entity, $entity_type, $view_mode, $langcode) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
// If the entity has commerce_price rendered.
if (isset($entity->content['product:commerce_price'])) {
$entity->content['product:commerce_price'] += array(
'#prefix' => '',
'#suffix' => '',
);
$class = drupal_html_class(implode('-', array(
$entity_type,
$id,
'product',
'commerce_price',
'wrapper',
)));
$entity->content['product:commerce_price']['#prefix'] = '<div class="' . $class . '">' . $entity->content['product:commerce_price']['#prefix'];
$entity->content['product:commerce_price']['#suffix'] .= '</div>';
}
}