Extracted from #1057158: Provide an action for modifying entity values.
Action forms should be able to use #ajax.
In the case above it is absolutely required, because the action is embedding Field API widgets, so it has no control over them.

What needs to happen:
1) Pass $form_state to action forms. The core Actions API says that action forms only receive $context. However, we can just pass $form_state as the second param, and no harm done. If most actions don't take it or use it, that's fine.

2) ViewsBulkOperationsAction::formValidate() and ViewsBulkOperationsAction::formSubmit() have the actions_do() trick for making sure the action file is still included. Now we need the same thing in ViewsBulkOperationsAction::form(), since the action file might not be there after an ajax rebuild.

There is no nicer way than including all possible action files, because the Action API doesn't support that, and even if VBO implemented an extra "file" key for the few actions it supports, other actions would still have the same problem, leading to even more workarounds in the code.
I tried solving this with $form_state['build_info']['files']['form'], but no luck, so I'll have to go with the actions_do trick.

Comments

bojanz’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.