function _menu_target_set_link in Menu target 7
Adds the mlid to the menu_target_links table
2 calls to _menu_target_set_link()
- menu_target_menu_link_insert in ./
menu_target.module - Implements hook_menu_link_insert(). When a new menu item is created, check to see if they selected the target attribute. If so, save an entry in the menu_target_links table
- _menu_target_edit_form_extra_elements_submit in ./
menu_target.module - Implements hook_form_submit(). This is only needed when the menu_target attribute is updated, since the mlid is not available to this function when the menu item is new.
File
- ./
menu_target.module, line 126 - Allows content editors to choose wether or not to open menu items in a new window
Code
function _menu_target_set_link($mlid) {
$data = (object) array(
'mlid' => $mlid,
);
if ($saved = drupal_write_record('menu_target_links', $data)) {
drupal_set_message(t('The menu item for this content will now open in a new window.'));
}
else {
drupal_set_message(t('An error occured while setting the menu target.'), 'error');
}
}