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 = $this->cacheBackend
->get('field_info:fields')) {
$this->fieldsById = $cached->data;
}
else {
// Collect and prepare fields.
foreach (field_read_fields(array(), array(
'include_deleted' => TRUE,
)) as $field) {
$this->fieldsById[$field['uuid']] = $this
->prepareField($field);
}
// Store in persistent cache.
$this->cacheBackend
->set('field_info:fields', $this->fieldsById, CacheBackendInterface::CACHE_PERMANENT, array(
'field_info' => TRUE,
));
}
// Fill the name/ID map.
foreach ($this->fieldsById as $field) {
if (!$field['deleted']) {
$this->fieldIdsByName[$field['id']] = $field['uuid'];
}
}
$this->loadedAllFields = TRUE;
return $this->fieldsById;
}