function field_info_fields

Returns all field definitions.

Use of this function should be avoided when possible, since it loads and statically caches a potentially large array of information. Use field_info_field_map() instead.

When iterating over the fields present in a given bundle after a call to field_info_instances($entity_type, $bundle), it is recommended to use field_info_field() on each individual field instead.

Return value

An array of field definitions, keyed by field name. Each field has an additional property, 'bundles', which is an array of all the bundles to which this field belongs, keyed by entity type.

See also

field_info_field_map()

Related topics

5 calls to field_info_fields()
FieldInfoTest::testFieldInfo in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
Test that field types and field definitions are correctly cached.
FieldInfoTest::testFieldInfoCache in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
Tests that the field info cache can be built correctly.
field_views_data in drupal/core/modules/field/field.views.inc
Implements hook_views_data().
field_views_data_alter in drupal/core/modules/field/field.views.inc
Implements hook_views_data_alter().
RelationLinkManager::writeCache in drupal/core/modules/rest/lib/Drupal/rest/LinkManager/RelationLinkManager.php
Writes the cache of relation links.

File

drupal/core/modules/field/field.info.inc, line 287
Field Info API, providing information about available fields and field types.

Code

function field_info_fields() {
  $info = Field::fieldInfo()
    ->getFields();
  $fields = array();
  foreach ($info as $key => $field) {
    if (!$field['deleted']) {
      $fields[$field['field_name']] = $field;
    }
  }
  return $fields;
}