You are here

function _agls_fix_tags_7001 in AGLS Metadata 7

Fix naming of the tags for update 7001.

1 string reference to '_agls_fix_tags_7001'
agls_update_7001 in ./agls.install
Fix Metatag records for DC and AGLS.

File

./agls.install, line 150
Update scripts for the AGLS module.

Code

function _agls_fix_tags_7001($record) {
  if (!empty($record->data)) {
    foreach ($record->data as $tag_name => $tag_data) {

      // Determine if this tag specifies a schema.
      if (strpos($tag_name, '.')) {
        list($schema, $schema_property) = explode('.', $tag_name);
      }
      elseif (strpos($tag_name, ':')) {
        list($schema, $schema_property) = explode(':', $tag_name);
      }
      else {
        continue;
      }

      // Correct DCTERMS, which changed case when moved to metatag_dc.
      if ($schema == 'DCTERMS') {
        unset($record->data[$tag_name]);
        $record->data[strtolower($tag_name)] = $tag_data;
      }

      // Correct AGLSTERMS, which changed case and format in beta2.
      if (strtolower($schema) == 'aglsterms') {
        unset($record->data[$tag_name]);
        $record->data['AGLSTERMS.' . $schema_property] = $tag_data;
      }
    }
  }
  return $record;
}