You are here

function _filefield_paths_fix_references_fields in File (Field) Paths 6.2

1 call to _filefield_paths_fix_references_fields()
_filefield_paths_replace_pattern in includes/fix_references.inc
Run regular expression over all available text-based fields.

File

includes/fix_references.inc, line 47

Code

function _filefield_paths_fix_references_fields($node) {
  static $fields = array();
  if (!isset($fields[$node->type]) || !is_array($fields[$node->type])) {

    // Node body.
    if (isset($node->body)) {
      $fields[$node->type]['body'] =& $node->body;
      $fields[$node->type]['teaser'] =& $node->body;
    }

    // Node teaser.
    if (isset($node->teaser)) {
      $fields['teaser'] =& $node->teaser;
    }

    // Get CCK fields.
    $content_type = content_types($node->type);
    foreach ($content_type['fields'] as $name => $field) {
      if ($field['type'] == 'text' && is_array($node->{$name})) {
        foreach ($node->{$name} as $key => $value) {
          if (isset($node->{$name}[$key]['value'])) {
            $fields["{$name}_{$key}"] =& $node->{$name}[$key]['value'];
          }
        }
      }
    }
  }
  return $fields[$node->type];
}