Follow-up to #1885480: theme_hook_suggestions are wrong when specifying "Drupal default" for a field template while Extras uses a different default.

The function ds_extras_preprocess_field() adds theme hook suggestions for '#theme' => 'field' based on the "field template" or "field theme function" setting (the feature is not clearly named).

The code is a bit more confusing than necessary, it is not DRY.

There is also a misbehavior to be fixed:
If the field instance field template is set to "Drupal default", ds will use the globally configured field template, instead of sticking to Drupal default.

Fixing this and cleaning it up will leave us with cleaner-looking and more reliable code.
Patch will follow.

Comments

donquixote created an issue. See original summary.

donquixote’s picture

Status: Active » Needs review
StatusFileSize
new5.71 KB
donquixote’s picture

I made this with git format-patch for a nicer diff.

donquixote’s picture

Added inline comments.
Refactored building of the $config array.

donquixote’s picture

Removing unused $layout = ds_get_layout($entity_type, $bundle, $view_mode);.