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

15 calls to field_read_field()
FieldCrudTestCase::testDeleteField in modules/field/tests/field.test
Test the deletion of a field.
FieldCrudTestCase::testFieldIndexes in modules/field/tests/field.test
Test creation of indexes on data column.
FieldCrudTestCase::testReadField in modules/field/tests/field.test
Test reading back a field definition.
FieldCrudTestCase::_testActiveHelper in modules/field/tests/field.test
Helper function for testActive().
FieldInfo::getField in modules/field/field.info.class.inc
Returns a field definition from a field name.

... See full list

File

modules/field/field.crud.inc, line 315

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.