I'm trying to theme the output of a custom field (called field_sirul) using field--field-sirul.tpl.php in the templates/ folder of my Bootstrap (7.x-3.1-beta1+23-dev) subtheme (built with cdn starterkit).

When using node or page templates, everything works OK, but I can't for the life of me get field templates to get picked up by my subtheme.

Is there any special handling for field templates in Bootstrap-3.x- ?

Comments

markhalliwell’s picture

Status: Active » Postponed (maintainer needs more info)
Related issues: +#2228943: [REGRESSION] Template suggestions not being used

No. This project doesn't touch fields in anyway. I know for a fact they work though because in several projects I do, I use field overrides quite frequently. The only thing I can think of (off the top of my head) is that you're not actually using the correct field name. The easiest way to figure this out is to do a preprocess on all fields and detect the field name via:

/**
 * Implements hook_preprocess_field().
 */
function YOURTHEME_preprocess_field(&$variables) {
  $element = $variables['element'];
  // If you have devel enabled, otherwise:
  // var_dump($element['#field_name']);
  dpm($element['#field_name']);

  // You may also want to check the existing suggestions:
  dpm($variables['theme_hook_suggestions']);
}

There is a possibility that #2098551: Registry alter does not keep proper order of [pre]process functions is related, but I highly doubt it since this is regarding a template. It could be related to #2228943: [REGRESSION] Template suggestions not being used though. Definitely need more information before we can proceed further.

PascalAnimateur’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
Related issues: +#2193925: breaks theme field overriding

Thanks for the clarification.. I think I figured it out : semantic_fields breaks all field overrides (see related issue).

Closing this issue as it has nothing to do with bootstrap!

markhalliwell’s picture

Ah, yeah... that module :) FWIW, Display Suite has the ability to override field templates in their ds_extras sub-module. It works, much better IMO, as you can explicitly select the fields you want to override.