You are here

function lingotek_attach_xml in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.6 lingotek.module \lingotek_attach_xml()
1 call to lingotek_attach_xml()
lingotek_lingotek_entity_upload_alter in ./lingotek.module
Implements hook_lingotek_entity_upload_alter().

File

./lingotek.module, line 2988

Code

function lingotek_attach_xml($xml, $name, $value) {
  if (is_object($value) || is_array($value)) {
    $sub_xml = $xml
      ->addChild($name);
    foreach ($value as $k => $v) {
      lingotek_attach_xml($sub_xml, $k, $v);
    }
  }
  else {
    $sub_xml = $xml
      ->addChild($name);
    if ($value) {
      $element = $sub_xml
        ->addChild('element');

      //TODO: encode $value to prevent xml corruption.
      $element
        ->addCData(lingotek_filter_placeholders($value));
    }
  }
}