function field_read_field

Reads a single field record directly from the database.

Generally, you should use the field_info_field() instead.

This function will not return deleted fields. Use field_read_fields() instead for this purpose.

Parameters

$field_name: The field name to read.

array $include_additional: The default behavior of this function is to not return a field that is inactive. Setting $include_additional['include_inactive'] to TRUE will override this behavior.

Return value

A field definition array, or FALSE.

Related topics

17 calls to field_read_field()
CrudTest::testDeleteField in drupal/core/modules/field/lib/Drupal/field/Tests/CrudTest.php
Test the deletion of a field.
CrudTest::testFieldIndexes in drupal/core/modules/field/lib/Drupal/field/Tests/CrudTest.php
Test creation of indexes on data column.
CrudTest::testReadField in drupal/core/modules/field/lib/Drupal/field/Tests/CrudTest.php
Tests reading a single field definition.
CrudTest::_testActiveHelper in drupal/core/modules/field/lib/Drupal/field/Tests/CrudTest.php
Helper function for testActive().
EntityTranslationTest::setUp in drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
Sets up a Drupal site for running functional and integration tests.

... See full list

File

drupal/core/modules/field/field.crud.inc, line 318
Field CRUD API, handling field and field instance creation and deletion.

Code

function field_read_field($field_name, $include_additional = array()) {
  $fields = field_read_fields(array(
    'field_name' => $field_name,
  ), $include_additional);
  return $fields ? current($fields) : FALSE;
}