Right now, fences just uses <div> as the default configuration for all divs. It would be awesome if it could provide different defaults depending on what field.

We need to add an API so that fences (and possibly other modules or themes) can provide some default configurations for fields.

For example, comment body field needs NO wrapper at all. And a node's "Tags" taxonomy field should be a UL.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iamEAP’s picture

Status: Needs review » Active
FileSize
845 bytes

I wonder if a simple module invocation is too naive a solution? Patch attached.

Example usage:

function MY_MODULE_fences_default_suggestions() {
  $suggestions = array();

  // Define suggestion in this way.
  $suggestions['node']['node_type']['field_name'] = 'h2';

  return $suggestions;
}
iamEAP’s picture

Status: Active » Needs review

Whoops. Needs review.

Status: Active » Needs review
JohnAlbin’s picture

Issue summary: View changes

Additionally, we could have a config screen that allows you to set default HTML wrapper for certain sets of fields.

Like taxonomy terms could always use UL elements. Body field to have no wrapper. Image fields to have figcaption?

JohnAlbin’s picture

Status: Needs review » Needs work

Yep. Hook-based default configuration is a good idea.

JohnAlbin’s picture

This would be a backwards-incompatible update.