public function FieldInfo::prepareField

Prepares a field definition for the current run-time context.

Parameters

$field: The raw field structure as read from the database.

Return value

The field definition completed for the current runtime context.

4 calls to FieldInfo::prepareField()
FieldInfo::getBundleInstances in drupal/modules/field/field.info.class.inc
Retrieves the instances for a bundle.
FieldInfo::getField in drupal/modules/field/field.info.class.inc
Returns a field definition from a field name.
FieldInfo::getFieldById in drupal/modules/field/field.info.class.inc
Returns a field definition from a field ID.
FieldInfo::getFields in drupal/modules/field/field.info.class.inc
Returns all active fields, including deleted ones.

File

drupal/modules/field/field.info.class.inc, line 493

Class

FieldInfo
Provides field and instance definitions for the current runtime environment.

Code

public function prepareField($field) {

  // Make sure all expected field settings are present.
  $field['settings'] += field_info_field_settings($field['type']);
  $field['storage']['settings'] += field_info_storage_settings($field['storage']['type']);

  // Add storage details.
  $details = (array) module_invoke($field['storage']['module'], 'field_storage_details', $field);
  drupal_alter('field_storage_details', $details, $field);
  $field['storage']['details'] = $details;

  // Populate the list of bundles using the field.
  $field['bundles'] = array();
  if (!$field['deleted']) {
    $map = $this
      ->getFieldMap();
    if (isset($map[$field['field_name']])) {
      $field['bundles'] = $map[$field['field_name']]['bundles'];
    }
  }
  return $field;
}