Solved

Create a Drupal 6 Action to Delete a Nodes menu link

Posted on 2009-04-07
1
566 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

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 socially coordinated efforts have turned into a critical requirement for enterprises.
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.

726 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