4

I've read from http://drupal.org/node/1089656 that I can create a template for a field in specific content type as field--field-name--content-type.tpl.php.

I have a custom content type "festivals_events" and a cck field "field_description". So, I created a template "field--field_description--festivals_events.tpl.php". But it is not working.

I tried to replace _ in field name with - as suggested in Template Suggestion, http://drupal.org/node/1089656, to become my template name file name as "field--field-description--festivals_events.tpl.php" This too is not working.

I think it is definitely can be used as it is mentioned in Template Suggestion. What is wrong with me?

Thanks in advance.

0

1 Answer 1

3

Try "-" in the contact type name like field--field-description--festivals-events.tpl.php

[Edit]
You may also need a template suggestion in your theme.

function mytheme_preprocess_field(&$variables) {
    if($variables['type'] == 'festivals-events'){
        if($variables['element']['#field_name'] == 'field_description') {
            $variables['theme_hook_suggestions'][] = 'field__field_description__festivals_events';
        }
    }
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.