/** * Utility function used by import_extender_plugin_hook() to process * an ODDMetaData and add it to an entity. This function does not * hit ->save() on the entity (this lets you construct in memory) * * @param ElggEntity $entity The entity to add the data to. * @param ODDMetaData $element The OpenDD element * * @return bool * @access private */ function oddmetadata_to_elggextender(ElggEntity $entity, ODDMetaData $element) { // Get the type of extender (metadata, type, attribute etc) $type = $element->getAttribute('type'); $attr_name = $element->getAttribute('name'); $attr_val = $element->getBody(); switch ($type) { // Ignore volatile items case 'volatile': break; case 'annotation': $entity->annotate($attr_name, $attr_val); break; case 'metadata': $entity->setMetaData($attr_name, $attr_val, "", true); break; default: // Anything else assume attribute $entity->set($attr_name, $attr_val); } // Set time if appropriate $attr_time = $element->getAttribute('published'); if ($attr_time) { $entity->set('time_updated', $attr_time); } return true; }