Theming product field in template.php D7
I am attempting to theme a product field in my template.php file but I have no idea the correct way to reference the field. I have looked for documentation, but come up empty. Here is an example:
The field machine name is "product:field_product_images".
Normally the theming function would be:
THEMENAME_field__product:field_product_images__product_display($vars)
Obviously the ":" in the machine name doesn't belong, but I can't get the function to work replacing it with "_" or dropping the entire "product:" prefix.
How do I reference this field to access it in the theming function?
Thanks,
Jason
Comments
Solution
The solution is to theme the field as part of the product, not as part of the product display. In my example instead of using:
THEMENAME_field__product:field_product_images__product_display($vars)
I am using:
THEMENAME_field__field_product_images__product($vars)
Hope this helps someone else out.
Could you elaborate a bit
Could you elaborate a bit further on this? I've tried the following custom function in my theme's template.php file but it doesn't seem to be working.
<?php
function THEMENAME_field__field_product_slider__product($vars) {
foreach ($vars['items'] as $delta => $item) {
$output .= '<li>' . drupal_render($item) . '</li>';
}
return $output;
}
?>