public function LingotekConfigSet::documentLingotekXML in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekConfigSet.php \LingotekConfigSet::documentLingotekXML()
Gets the contents of this item formatted as XML to be sent to Lingotek.
Return value
string The XML document representing the entity's translatable content.
Overrides LingotekTranslatableEntity::documentLingotekXML
File
- lib/
Drupal/ lingotek/ LingotekConfigSet.php, line 693 - Defines LingotekConfigSet.
Class
- LingotekConfigSet
- A class wrapper for Lingotek-specific behavior on ConfigSets.
Code
public function documentLingotekXML() {
$translatable = array();
// for now, assume all strings in locales_source table for the given set are translatable
if (TRUE) {
$translatable = array_keys($this->source_data);
}
$content = '';
foreach ($translatable as $field) {
$field_data = $this->source_data[$field];
if (variable_get('lingotek_config_encode_ampersand', FALSE)) {
$field_data = str_replace("&", "&", $field_data);
}
$text = lingotek_filter_placeholders($field_data, TRUE);
if ($text) {
$current_field = '<' . self::TAG_PREFIX . $field . '>';
$current_field .= '<element><![CDATA[' . $text . ']]></element>' . "\n";
$current_field .= '</' . self::TAG_PREFIX . $field . '>';
$content .= $current_field . "\n";
}
}
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><contents>{$content}</contents>";
}