function _field_info_collate_fields

Collates all information on existing fields and instances.

Deprecated. This function is kept to ensure backwards compatibility, but has a serious performance impact, and should be absolutely avoided. See http://drupal.org/node/1915646.

Use the regular field_info_*() API functions to access the information, or field_info_cache_clear() to clear the cached data.

Related topics

File

modules/field/field.info.inc, line 76

Code

function _field_info_collate_fields($reset = FALSE) {
    if ($reset) {
        _field_info_field_cache()->flush();
        return;
    }
    $cache = _field_info_field_cache();
    // Collect fields, and build the array of IDs keyed by field_name.
    $fields = $cache->getFields();
    $field_ids = array();
    foreach ($fields as $id => $field) {
        if (!$field['deleted']) {
            $field_ids[$field['field_name']] = $id;
        }
    }
    // Collect extra fields for all entity types.
    $extra_fields = array();
    foreach (field_info_bundles() as $entity_type => $bundles) {
        foreach ($bundles as $bundle => $info) {
            $extra_fields[$entity_type][$bundle] = $cache->getBundleExtraFields($entity_type, $bundle);
        }
    }
    return array(
        'fields' => $fields,
        'field_ids' => $field_ids,
        'instances' => $cache->getInstances(),
        'extra_fields' => $extra_fields,
    );
}

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