You are here

function fences_get_suggestion in Fences 7

Same name and namespace in other branches
  1. 7.2 fences.module \fences_get_suggestion()

Returns the wrapper suggestion if it exists.

Parameters

$entity_type: The entity type for the instance.

$bundle_name: The bundle name for the instance.

$field_name: The field name for the instance.

Return value

The fences wrapper suggestion for this field, if set.

See also

field_info_instance()

2 calls to fences_get_suggestion()
fences_preprocess_field in ./fences.module
Implements hook_preprocess_field().
_fences_form_field_ui_field_edit_form_alter in ./fences.admin.inc
Implements hook_form_FORM_ID_alter().

File

./fences.module, line 135
Fences is a module providing configurable field wrappers.

Code

function fences_get_suggestion($entity_type, $bundle_name, $field_name) {
  $fences =& drupal_static(__FUNCTION__, array());
  if (!isset($fences[$entity_type][$bundle_name][$field_name])) {

    // Instance info is cached, so this isn't as non-performant as it looks.
    $settings = field_info_instance($entity_type, $field_name, $bundle_name);
    $fences[$entity_type][$bundle_name][$field_name] = isset($settings['fences_wrapper']) ? $settings['fences_wrapper'] : '';
  }
  return $fences[$entity_type][$bundle_name][$field_name];
}