function globallink_menu_get_xml in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink_menu/globallink_menu.inc \globallink_menu_get_xml()
- 7.6 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_preview_content in globallink_menu/
globallink_menu_send.inc - Helper function
- globallink_menu_send_for_translations in globallink_menu/
globallink_menu.inc - Sends menus for translation.
File
- globallink_menu/
globallink_menu.inc, line 83
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, GLOBALLINK_ENTITY_TYPE_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, GLOBALLINK_ENTITY_TYPE_MENU, $link['options']['attributes']['title'], array(
'name' => 'title',
));
}
}
}
$xml = $dom
->saveXML();
return $xml;
}