You are here

function _field_orbit_get_fields in ZURB Orbit 7.2

Same name and namespace in other branches
  1. 7 field_orbit.module \_field_orbit_get_fields()

Helper function to retrieve field information.

Parameters

$field_types:

$entity_type:

string $field_name:

Return value

array

2 calls to _field_orbit_get_fields()
field_orbit_field_formatter_settings_form in ./field_orbit.module
Implements hook_field_formatter_settings_form().
field_orbit_field_formatter_settings_summary in ./field_orbit.module
Implements hook_field_formatter_settings_summary().

File

./field_orbit.module, line 770
Implement a orbit formatter for fields.

Code

function _field_orbit_get_fields($field_types, $entity_type, $field_name = '') {
  $links = array();
  $fields = field_info_fields();
  switch ($entity_type) {
    case 'file':
    case 'image':
      $bundle = 'file';
      $bundle_instance = 'image';
      $entity_label = t('File Entity field:');
      break;
  }
  foreach ($fields as $name => $field) {
    if (in_array($bundle, array_keys($field['bundles'])) && in_array($bundle_instance, $field['bundles'][$bundle]) && in_array($field['type'], $field_types)) {
      $infos = field_info_instance($bundle, $name, $bundle_instance);
      $links[$name] = $entity_label . ' ' . $infos['label'];
    }
  }
  return $links;
}