function globallink_menu_get_xml in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink_menu/globallink_menu.inc \globallink_menu_get_xml()
- 7.5 globallink_menu/globallink_menu.inc \globallink_menu_get_xml()
Gets XML data from specific menu.
Parameters
string $mlid: The menu ID.
Return value
array Associative array of block XML data.
2 calls to globallink_menu_get_xml()
- globallink_menu_get_translations_for_row_id in globallink_menu/
globallink_menu_receive.inc - Gets menu translations by row ID.
- globallink_menu_send_for_translations in globallink_menu/
globallink_menu.inc - Sends menus for translation.
File
- globallink_menu/
globallink_menu.inc, line 81
Code
function globallink_menu_get_xml($mlid) {
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = TRUE;
$root = $dom
->createElement('content');
$dom
->appendChild($root);
$id = $dom
->createAttribute('mlid');
$id->value = $mlid;
$root
->appendChild($id);
$link = menu_link_load($mlid);
globallink_insert_child_element($dom, $root, 'menu', $link['link_title'], array(
'name' => 'link_title',
));
if (isset($link['options']) && isset($link['options']['attributes'])) {
if (isset($link['options']['attributes']['title'])) {
if (is_string($link['options']['attributes']['title'])) {
globallink_insert_child_element($dom, $root, 'menu', $link['options']['attributes']['title'], array(
'name' => 'title',
));
}
}
}
$xml = $dom
->saveXML();
return $xml;
}