function commerce_product_attributes_handler_field_attributes::render in Commerce Product Attributes 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- includes/
views/ handlers/ commerce_product_attributes_handler_field_attributes.inc, line 48 - Attribute handler for the attribute field.
Class
- commerce_product_attributes_handler_field_attributes
- Field handler to present an order's operations links.
Code
function render($values) {
$line_item_id = $this
->get_value($values, 'line_item_id');
$line_item = commerce_line_item_load($line_item_id);
$line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
$properties = $line_item_wrapper
->getPropertyInfo();
$element = array();
if (isset($properties['commerce_display_path']) && $this->options['link_with_line_item']) {
$path = $line_item_wrapper->commerce_display_path
->value();
$options = array(
'query' => array(
'line_item_id' => $line_item_id,
),
);
}
else {
$path = NULL;
$options = array();
}
$element['title'] = array(
'#markup' => theme('commerce_product_attributes_item_title', array(
'item' => $line_item,
'path' => $path,
'options' => $options,
'create_link' => $this->options['show_link'],
)),
);
$hook = 'attribute_field';
foreach (module_implements($hook) as $module_name) {
$function = $module_name . '_' . $hook;
if (function_exists($function)) {
$function($element, $line_item);
}
}
$element['#attached']['css'][] = drupal_get_path('module', 'commerce_product_attributes') . '/theme/commerce_product_attributes_cart.css';
return drupal_render($element);
}