/** * Add a relatedItem element. * * Checks the $text to see if it looks like a URL, and creates a * location subelement if so. Otherwise, a titleInfo is used. * * @param DomElement $mods * @param string $text * @param bool $original */ private function _addRelatedItem($mods, $text, $original = false) { $relatedItem = $mods->appendNewElement('relatedItem'); if ($this->_isUrl($text)) { $titleInfo = $relatedItem->appendNewElement('titleInfo'); $titleInfo->appendNewElement('title', $text); } else { $location = $relatedItem->appendNewElement('location'); $location->appendNewElement('url', $text); } if ($original) { $relatedItem->setAttribute('type', 'original'); } }