Returns all active fields, including deleted ones.
An array of field definitions, keyed by field ID.
public function getFields() {
// Read from the "static" cache.
if ($this->loadedAllFields) {
return $this->fieldsById;
}
// Read from persistent cache.
if ($cached = cache_get('field_info:fields', 'cache_field')) {
$this->fieldsById = $cached->data;
}
else {
// Collect and prepare fields.
foreach (field_read_fields(array(), array(
'include_deleted' => TRUE,
)) as $field) {
$this->fieldsById[$field['id']] = $this
->prepareField($field);
}
// Store in persistent cache.
if (lock_acquire('field_info:fields')) {
cache_set('field_info:fields', $this->fieldsById, 'cache_field');
lock_release('field_info:fields');
}
}
// Fill the name/ID map.
foreach ($this->fieldsById as $field) {
if (!$field['deleted']) {
$this->fieldIdsByName[$field['field_name']] = $field['id'];
}
}
$this->loadedAllFields = TRUE;
return $this->fieldsById;
}