/[drupal]/contributions/modules/automenu/automenu.module
ViewVC logotype

Diff of /contributions/modules/automenu/automenu.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Mon Jun 9 08:04:05 2008 UTC revision 1.1.2.1, Wed Oct 1 07:25:41 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: automenu.module,v 1.1 2008/06/09 08:04:05 danielfs Exp $
3    
4  /**  /**
5   * Implementation of hook_nodeapi().   * Implementation of hook_nodeapi().
6   * Fill in menu section values if user left them empty AND there's a parent   * Fill in menu section values if user left them empty AND there's a parent
7   * menu item selected for this node type.   * menu item selected for this node type AND the node is published
8   */   */
9  function automenu_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {  function automenu_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
10    switch ($op) {    switch ($op) {
11      case 'submit':      case 'submit':
12        $parent_menu = variable_get('parentmenu_'. $node->type, 0);        $parent_menu = variable_get('parentmenu_'. $node->type, 0);
13        if ($parent_menu != 0) {        if ($parent_menu != 0) {
14          if (($node->menu['title'] == '') || ($node->menu['delete'])) {          if ((($node->menu['title'] == '') || ($node->menu['delete'])) && ($node->status == 1)) {
15            $node->menu['title'] = $node->title;            $node->menu['title'] = $node->title;
16            $node->menu['pid'] = $parent_menu;            $node->menu['pid'] = $parent_menu;
17            unset($node->menu['delete']);            unset($node->menu['delete']);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2