Collates all information on field types, widget types and related structures.
An associative array containing:
_field_info_collate_types_reset()
function _field_info_collate_types() {
$language_interface = language(LANGUAGE_TYPE_INTERFACE);
// 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_collate_types'] =& drupal_static(__FUNCTION__);
}
$info =& $drupal_static_fast['field_info_collate_types'];
// The _info() hooks invoked below include translated strings, so each
// language is cached separately.
$langcode = $language_interface->langcode;
if (!isset($info)) {
if ($cached = cache('field')
->get("field_info_types:{$langcode}")) {
$info = $cached->data;
}
else {
$info = array(
'field types' => array(),
'storage types' => array(),
);
// Populate field types.
foreach (module_implements('field_info') as $module) {
$field_types = (array) module_invoke($module, 'field_info');
foreach ($field_types as $name => $field_info) {
// Provide defaults.
$field_info += array(
'settings' => array(),
'instance_settings' => array(),
);
$info['field types'][$name] = $field_info;
$info['field types'][$name]['module'] = $module;
}
}
drupal_alter('field_info', $info['field types']);
// Populate storage types.
foreach (module_implements('field_storage_info') as $module) {
$storage_types = (array) module_invoke($module, 'field_storage_info');
foreach ($storage_types as $name => $storage_info) {
// Provide defaults.
$storage_info += array(
'settings' => array(),
);
$info['storage types'][$name] = $storage_info;
$info['storage types'][$name]['module'] = $module;
}
}
drupal_alter('field_storage_info', $info['storage types']);
cache('field')
->set("field_info_types:{$langcode}", $info, CacheBackendInterface::CACHE_PERMANENT, array(
'field_info_types' => TRUE,
));
}
}
return $info;
}