For a custom Views Views Bulk Operations action, I would like to enhance the information in the list on the confirm page, For example, instead of:
I would like to have:
Where is the best place to alter this?
There are basically two ways to do this in Drupal 8:
hook_form_views_bulk_operations_confirm_action_alter
. This will allow you to alter the list, for example with custom values and code./**
* Action description.
*
* @Action(
* id = "my_special_action",
* label = @Translation("My Special Action"),
* type = "custom_entity",
* confirm_form_route_name = "my_module.my_special_action_confirm_form",
* )
*/
class MySpecialAction extends ViewsBulkOperationsActionBase {
}
and the Form will look something like this:
use Drupal\views_bulk_operations\Form\ConfirmAction;
class MySpecialActionConfirmForm extends ConfirmAction {
public function getFormId() {
return 'my_special_action_confirm_form';
}
public function buildForm(array $form, FormStateInterface $form_state, $view_id = NULL, $display_id = NULL) {
....
}
In the custom form class, you will have to define your own submitForm method, if you want to pass anything special to the custom action.