function field_info_field_map

Returns a lightweight map of fields across bundles.

The function only returns active, non deleted fields.

array(
  'body' => array(
    'bundles' => array(
      'node' => array(
        'page',
        'article',
      ),
    ),
    'type' => 'text_with_summary',
  ),
);

Return value

An array keyed by field name. Each value is an array with two entries:

  • type: The field type.
  • bundles: The bundles in which the field appears, as an array with entity types as keys and the array of bundle names as values.

Example:

Related topics

3 calls to field_info_field_map()
Field::getBundles in drupal/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php
Returns the list of bundles where the field has instances.
FieldInfoTest::testFieldMap in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
Test field_info_field_map().
Tables::addField in drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php

File

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

Code

function field_info_field_map() {
  return Field::fieldInfo()
    ->getFieldMap();
}