function globallink_insert_child_element in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink.inc \globallink_insert_child_element()
- 7.5 globallink.inc \globallink_insert_child_element()
Inserts child element into DOM.
Parameters
array $dom: Array representation of the DOM.
array $root: The root of the DOM.
string $elem_name: The desired name of the element.
string $elem_value: The desired value of the element.
array $attributes: Array of desired attributes for the element. Defaults to NULL.
13 calls to globallink_insert_child_element()
- globallink_beans_get_xml in globallink_beans/
globallink_beans.inc - Gets XML data from specific bean.
- globallink_beans_traverse_fields_and_field_collections in globallink_beans/
globallink_beans.inc - Recursively adds fields and field collections to translation XML document.
- globallink_block_get_xml in globallink_block/
globallink_block.inc - Gets XML data from specific block.
- globallink_entity_generate_xml_document in globallink_entity/
globallink_entity.inc - Generates XML document for entity.
- globallink_entity_traverse_fields_and_field_collections in globallink_entity/
globallink_entity.inc - Traverses entity fields and field collections.
File
- ./
globallink.inc, line 89 - Miscellaneous GlobalLink functions for node translations (non-entity).
Code
function globallink_insert_child_element($dom, $root, $elem_name, $elem_value, $attributes = NULL) {
if ($elem_name && $elem_value) {
$item = $dom
->createElement($elem_name);
if (isset($attributes) && is_array($attributes)) {
foreach ($attributes as $key => $value) {
$item
->setAttribute($key, $value);
}
}
$text = $dom
->createTextNode($elem_value);
$item
->appendChild($text);
$root
->appendChild($item);
}
}