You are here

function field_extract_field_info_alter in Field Extract Values 7

Implements hook_field_info_alter().

Add the extractor information to the field_info, the primary use for this is for the field_extract module itself to add extractors to all standard field types.

File

./field_extract.module, line 260
Field extract - Extension of the Field API to allow proper extraction of field values from entities

Code

function field_extract_field_info_alter(&$info) {

  // Fetch extractor information
  $extractors = module_invoke_all('field_extract_info');

  // allow other modules a look in to change them
  drupal_alter('field_extract_info', $extractors);

  // Run through each extractor we've found and
  // match it up with a field type
  foreach ($extractors as $name => $extractor) {

    // Only try to add this extractor info
    // if the field_info has this type of field
    // which does not already have an extractor
    if (isset($info[$name]) && !isset($info[$name]['extractor'])) {

      // Set up the default options if none exist
      if (!isset($extractor['options'])) {
        $extractor['options'] = array();
      }
      $info[$name]['extractor'] = $extractor;
    }
  }
}