function _field_info_field_cache

_field_info_field_cache()

Retrieves the FieldInfo object for the current request.

Return value

FieldInfo An instance of the FieldInfo class.

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!field.info.inc/function/_field_info_field_cache/7.x