• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 583
  • Last Modified:

Create a Drupal 6 Action to Delete a Nodes menu link

Hi Experts,

I'm proficient in PHP but novice in Drupal. I have Actions, Triggers and Workflow setup. From what I've read I need to create a function to implement hook_action_info() and a callback function which calls menu_link_delete. Does anybody know what I'm talking about and can anybody tell me how to do this?

To be precise when a Workflow transition is triggered on a particular Node (called Exhibition) I want an Action that removes any reference to the Node from the Primary Navigation menu.

Thanks!
mstrelan
0
mstrelan
Asked:
mstrelan
1 Solution
 
mstrelanAuthor Commented:
Well no one replied but I found the solution myself. 1. Make a module 2. Create an action. See below
; File menu_unlink.info
name = "Menu Unlink"
description = "Provides menu unlinking actions for nodes"
core = 6.x
 
' File menu_unlink.module
<?php
function menu_unlink_action_info() {
  return array(
    'menu_unlink_remove_from_menu_action' => array(
      'type' => 'node',
      'description' => t('Remove from menu'),
      'configurable' => FALSE,
      'behavior' => array('changes_node_property'),
      'hooks' => array(
        'nodeapi' => array('presave'),
      ),
    ),
  );
}
 
function menu_unlink_remove_from_menu_action(&$node, $context = array()) {
  menu_link_delete(NULL, 'node/' . $node->nid);
}

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now