mediatribe.net -- Drupal and Web Development

Notice: this post was last updated 6 years 15 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

Creating actions for use with views bulk operations

You can combine Views bulk operations with your own code to make powerful actions which can be applied to several nodes at the time.

Here is some sample code to create an action:

  /* describe your action(s) */
function mymodule_action_info() {
  return array(
    'mymodule_action_callback' => array(
       'type' => 'node',
       'description' => t('My action description.'),
       'configurable' => FALSE,
      )
    );
}

function mymodule_action_callback(&$node, $context) {
 
  /* do something with your node here */

  node_save($node);
}

This works for Drupal 6.0 -

This works for Drupal 6.0 - thanks.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.