Solved

Create a Drupal 6 Action to Delete a Nodes menu link

Posted on 2009-04-07
1
569 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…

717 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