0

I'm trying to add some custom actions to my Views Bulk Operations, but for some reason, they don't appear in the list. i want to add custom button to user can apply it and node DATE update to today...

This is my code (so I guess this is a working code...)

    /**
 * Implements hook_action_info().
 */
function custom_action_info() {
  return array(
    'custom_action_callback_name' => array(
      'type' => 'entity', // Can be file, term, user, etc.
      'label' => t('Your label'),
      'configurable' => FALSE, // Doesn't need config form
      'behavior' => array('view_property'), // Uses view access rights
      'triggers' => array('any'), // Works always
    ),
  );
}
/**
 * Add action callback where you perform the action. 
 */
function custom_action_callback_name($entity, $context) {

  // I DONT KNOW .....................

}
2
  • You mean it doesn't appear in the list of actions (buttons) when you visit the view page/block? Dec 31, 2016 at 15:16
  • Change this 'type' => 'entity' with an actual entity like comment, taxonomy , node, user etc and then retry
    – mchar
    Jan 2, 2017 at 8:02

1 Answer 1

1

I believe your type should not be entity but the actual entity type you want to use, like node. Then it should show up on nodes.

Also VBO requires no triggers to be defined, unless you want the action to be triggered via the action module as well. For just VBO this can be an empty array. I have no idea what behavior is, never used it.

See an example of VBO with a form here: Add multiple friends at once with user relationships

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.