0

I successfully created a new action using hook_action_info() and a corresponding hook_action(). However, I want to find the method which loops through the elements chosen by Views Bulk Operations, as I wanted to combine some pages for a pdf.

What method loops through the entities chosen by VBO?

0

Quoting the VBO Development guide, you can use the aggregate option to get a list of all chosen entities.

implement hook_action_info()

aggregate (optional): boolean. If TRUE, all selected objects' IDs (oids) will be packed in an array and passed as the first argument to the action function, instead of passing each object one by one. This is useful to implement aggregate functions that perform a single operation on the whole selection set.

Note this guide is only for D6. I have created a D7 version but could not add an aggregate example yet.

However, in your hook_action_info() implementation, set aggregate to TRUE (defaults to FALSE) and VBO will send a list of entity IDs (for you to perform additional related tasks).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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