function field_info_field

Returns data about an individual field, given a field name.

Parameters

$field_name: The name of the field to retrieve. $field_name can only refer to a non-deleted, active field. For deleted fields, use field_info_field_by_id(). To retrieve information about inactive fields, use field_read_fields().

Return value

The field array, as returned by field_read_fields(), with an additional element 'bundles', whose value is an array of all the bundles this field belongs to keyed by entity type. NULL if the field was not found.

See also

field_info_field_by_id()

Related topics

86 calls to field_info_field()
CommentFieldsTest::testCommentDefaultFields in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
Tests that the default 'comment_body' field is correctly added.
CommentLanguageTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
Sets up a Drupal site for running functional and integration tests.
CommentTranslationUITest::setupTestFields in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::setupTestFields().
custom_block_add_body_field in drupal/core/modules/block/custom_block/custom_block.module
Adds the default body field to a custom block type.
DirectEditor::isCompatible in drupal/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/DirectEditor.php
Implements \Drupal\edit\EditPluginInterface::isCompatible().

... See full list

File

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

Code

function field_info_field($field_name) {
  return Field::fieldInfo()
    ->getField($field_name);
}