On this page
public function FieldInfo::prepareField
public FieldInfo::prepareField($field)
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.
File
- 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;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!field.info.class.inc/function/FieldInfo::prepareField/7.x