/** * Reads a MultiText from the XmlNode $sxeNode given by the element 'form' * * @param SimpleXMLElement $sxeNode * @param ArrayOf $inputSystems * @param bool $ignoreErrors * @return MultiText */ public function readMultiText($sxeNode, $inputSystems = null, $ignoreErrors = false) { $multiText = new MultiText(); $this->addAndPushSubnodeError(LiftImportNodeError::MULTITEXT, $sxeNode->getName()); foreach ($sxeNode as $element) { switch ($element->getName()) { case 'form': $inputSystemTag = (string) $element['lang']; $multiText->form($inputSystemTag, $this->sanitizeSpans(dom_import_simplexml($element->text), $inputSystemTag)); $this->projectModel->addInputSystem($inputSystemTag); // TODO InputSystems should extend ArrayOf (or Map) and become more useful. CP 2014-10 if (isset($inputSystems)) { // i.e. $inputSystems->ensureFieldHasInputSystem($inputSystemTag); $inputSystems->value($inputSystemTag); } break; default: if (!$ignoreErrors) { $this->currentNodeError()->addUnhandledElement($element->getName()); } } } array_pop($this->nodeErrors); return $multiText; }
public function readMultiText($sxeNode, $existingMultiText = null, $inputSystems = null) { if (isset($existingMultiText)) { $multiText = $existingMultiText; } else { $multiText = new MultiText(); } if (isset($sxeNode->form)) { foreach ($sxeNode->form as $form) { $inputSystemTag = (string) $form['lang']; $multiText->form($inputSystemTag, (string) $form->text); // TODO: Do we need to count input systems found in LIFT ranges? I think no, because // the input systems found in ranges are ones for which an interface translation has // been defined, which is not the same concept as "ones for which data exists". 2014-09 RM //$this->_projectModel->addInputSystem($inputSystemTag); if (isset($inputSystems)) { $inputSystems->value($inputSystemTag); } } } return $multiText; }