You are here

function _field_info_field_cache in Drupal 7

Retrieves the FieldInfo object for the current request.

Return value

FieldInfo An instance of the FieldInfo class.

15 calls to _field_info_field_cache()
field_info_extra_fields in modules/field/field.info.inc
Returns a list and settings of pseudo-field elements in a given bundle.
field_info_field in modules/field/field.info.inc
Returns data about an individual field, given a field name.
field_info_fields in modules/field/field.info.inc
Returns all field definitions.
field_info_field_by_id in modules/field/field.info.inc
Returns data about an individual field, given a field ID.
field_info_field_by_ids in modules/field/field.info.inc
Returns the same data as field_info_field_by_id() for every field.

... See full list

File

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