You are here

protected function TMGMTFileformatXLIFF::writeBPT in Translation Management Tool 7

Writes beginning pair tag.

Parameters

XMLWriter $writer: Writer that writes the output.

DOMElement $node: Current node.

$id: Current node id.

1 call to TMGMTFileformatXLIFF::writeBPT()
TMGMTFileformatXLIFF::processForExport in translators/file/tmgmt_file.format.xliff.inc
Helper function to process the source text.

File

translators/file/tmgmt_file.format.xliff.inc, line 537

Class

TMGMTFileformatXLIFF
Export to XLIFF format.

Code

protected function writeBPT(XMLWriter $writer, DOMElement $node, $id) {
  $beginning_tag = '<' . $node->nodeName;
  if ($node
    ->hasAttributes()) {
    $attributes = array();

    /** @var DOMAttr $attribute */
    foreach ($node->attributes as $attribute) {
      $attributes[] = $attribute->name . '="' . $attribute->value . '"';
    }
    $beginning_tag .= ' ' . implode(' ', $attributes);
  }
  $beginning_tag .= '>';
  $writer
    ->startElement('bpt');
  $writer
    ->writeAttribute('id', $id);
  $writer
    ->text($beginning_tag);
  $writer
    ->endElement();
}