Writes img tag.
Note that alt and title attributes are not written as sub elements as Trados studio is not able to deal with two sub elements at one level.
XMLWriter $writer: Writer that writes the output.
DOMElement $node: Current node.
$id: Current node id.
protected function writeIMG(\XMLWriter $writer, \DOMElement $node, $id) {
$writer
->startElement('ph');
$writer
->writeAttribute('id', $id);
$writer
->writeAttribute('ctype', 'image');
foreach ($node->attributes as $attribute) {
// @todo - uncomment when issue with Trados/sub elements fixed.
/*
if (in_array($attribute->name, array('title', 'alt'))) {
continue;
}
*/
$writer
->writeAttribute($attribute->name, $attribute->value);
}
/*
if ($alt_attribute = $node->getAttribute('alt')) {
$writer->startElement('sub');
$writer->writeAttribute('id', $id . '-img-alt');
$writer->writeAttribute('ctype', 'x-img-alt');
$writer->text($alt_attribute);
$writer->endElement();
$this->elementsCount++;
}
if ($title_attribute = $node->getAttribute('title')) {
$writer->startElement('sub');
$writer->writeAttribute('id', $id . '-img-title');
$writer->writeAttribute('ctype', 'x-img-title');
$writer->text($title_attribute);
$writer->endElement();
$this->elementsCount++;
}
*/
$writer
->endElement();
}