Solved

Create a Drupal 6 Action to Delete a Nodes menu link

Posted on 2009-04-07
1
565 Views
Last Modified: 2013-11-10
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
Comment
Question by:mstrelan
1 Comment
 
LVL 10

Accepted Solution

by:
mstrelan earned 0 total points
ID: 24104118
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question