You are here

function taxonomy_xml_merge_predicates_into_attributes in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 5.2 taxonomy_xml.module \taxonomy_xml_merge_predicates_into_attributes()
  2. 5 taxonomy_xml.module \taxonomy_xml_merge_predicates_into_attributes()
  3. 6.2 taxonomy_xml.module \taxonomy_xml_merge_predicates_into_attributes()
  4. 7 taxonomy_xml.process.inc \taxonomy_xml_merge_predicates_into_attributes()

Merge all predicate data into a simpler array, re-tagging the attributes as needed

Parameters

$object - an object containing a 'predicates' array. For each: predicate, a cannonically named attribute will be attached to the object.

1 call to taxonomy_xml_merge_predicates_into_attributes()
taxonomy_xml_absorb_vocabulary_definitions in ./taxonomy_xml.module
Use the vocabs defined as resources in the input to find or create vocabulary definitions.

File

./taxonomy_xml.module, line 841
taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.

Code

function taxonomy_xml_merge_predicates_into_attributes(&$object) {
  $predicate_synonyms = taxonomy_xml_relationship_synonyms();
  foreach ($object->predicates as $predicate => $vals) {
    $predicate = isset($predicate_synonyms[$predicate]) ? $predicate_synonyms[$predicate] : $predicate;
    $object->{$predicate} = array_pop($vals);
  }
  if (empty($object->description) && isset($object->{TAXONOMY_XML_DESCRIPTION})) {
    $object->description = $object->{TAXONOMY_XML_DESCRIPTION};
  }
  return $object;
}