function _field_info_field_cache

7.x field.info.inc _field_info_field_cache()

Retrieves the FieldInfo object for the current request.

Return value

FieldInfo An instance of the FieldInfo class.

16 calls to _field_info_field_cache()
field_info_cache_clear in drupal/modules/field/field.info.inc
Clears the field info cache without clearing the field data cache.
field_info_extra_fields in drupal/modules/field/field.info.inc
Returns a list and settings of pseudo-field elements in a given bundle.
field_info_field in drupal/modules/field/field.info.inc
Returns data about an individual field, given a field name.
field_info_fields in drupal/modules/field/field.info.inc
Returns all field definitions.
field_info_field_by_id in drupal/modules/field/field.info.inc
Returns data about an individual field, given a field ID.

... See full list

File

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

Code

function _field_info_field_cache() {
  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static_fast;

  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['field_info_field_cache'] = &drupal_static(__FUNCTION__);
  }
  $field_info = &$drupal_static_fast['field_info_field_cache'];

  if (!isset($field_info)) {
    // @todo The registry should save the need for an explicit include, but not
    // a couple upgrade tests (DisabledNodeTypeTestCase,
    // FilterFormatUpgradePathTestCase...) break in a strange way without it.
    include_once dirname(__FILE__) . '/field.info.class.inc';
    $field_info = new FieldInfo();
  }

  return $field_info;
}