| 1 |
<?php |
<?php |
| 2 |
// $Id: automenu.module,v 1.1.4.3 2009/05/05 13:14:03 farbridges Exp $ |
// $Id: automenu.module,v 1.1.4.4 2009/05/05 14:15:21 farbridges Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_nodeapi(). |
* Implementation of hook_nodeapi(). |
| 21 |
'hidden' => variable_get('automenu_hide_'.$node->type, 0), |
'hidden' => variable_get('automenu_hide_'.$node->type, 0), |
| 22 |
//'customized' => true, // ? |
//'customized' => true, // ? |
| 23 |
); |
); |
| 24 |
|
if ($node->language) { |
| 25 |
|
$new_menu['options'] = array('langcode'=> $node->language); |
| 26 |
|
} |
| 27 |
|
if( $existing_item = db_fetch_array(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s' AND plid = %d", 'node/' . $node->nid, $new_menu['plid']))) { |
| 28 |
|
$new_menu['mlid']=$existing_item['mlid']; |
| 29 |
|
} |
| 30 |
if (!menu_link_save($new_menu)) { |
if (!menu_link_save($new_menu)) { |
| 31 |
drupal_set_message(t('There was an error saving the auto-menu link.'), 'error'); |
drupal_set_message(t('There was an error saving the auto-menu link.'), 'error'); |
| 32 |
} |
} |
| 33 |
else { |
else { |
| 34 |
drupal_set_message(t('The page was automatically added to: !menu.', array('!menu' => $parent_menu[0]))); |
drupal_set_message(t('The page was automatically added/updated to: !menu.', array('!menu' => $parent_menu[0]))); |
| 35 |
} |
} |
| 36 |
} |
} |
| 37 |
} |
} |