Problem/Motivation
Before the confirmation step, the "Publish Latest Revision" action has a configuration step where you can choose if it affects to all translations or only the selected ones.
View bulk operation saves the elections from the user on the temp store. But moderated_content_bulk_publish get this from configuration, so it will never get the value from the user.
ConfigureAction.php
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_data = $form_state->get('views_bulk_operations');
$action = $this->actionManager->createInstance($form_data['action_id']);
if (\method_exists($action, 'submitConfigurationForm')) {
$action->submitConfigurationForm($form, $form_state);
$form_data['configuration'] = $action->getConfiguration();
}
else {
$form_state->cleanValues();
$form_data['configuration'] = $form_state->getValues();
}
if (!empty($form_data['confirm_route'])) {
// Update tempStore data.
$this->setTempstoreData($form_data, $form_data['view_id'], $form_data['display_id']);
// Go to the confirm route.
$form_state->setRedirect($form_data['confirm_route'], [
'view_id' => $form_data['view_id'],
'display_id' => $form_data['display_id'],
]);
}
else {
$this->deleteTempstoreData($form_data['view_id'], $form_data['display_id']);
$this->actionProcessor->executeProcessing($form_data);
$form_state->setRedirectUrl($form_data['redirect_url']);
}
}
The RevisionActionBase, has the method submitConfigurationForm called from ConfigureAction
public function submitConfigurationForm(array &$form, FormStateInterface $formState): void {
$this->configuration['current_translation_only'] = $formState->getValue('current_translation_only');
}
So, in $this->configuration['current_translation_only'] is the right value.
Steps to reproduce
- Configure moderated_content_bulk_publish from /admin/config/content/moderated-content-bulk-publish
- Check "Should by default only affect to the selected translation?".
- Edit the content view and remove "Node Bulk Operations" and replace with "View bulk operations"
- Enable the action "Publish Latest Revision"
- Save the view
- Select a content with multiple unpublished translations from the content view
- Choose the action "Publish Latest Revision" and apply the action
- In the next step Configure "Publish Latest Revision" action applied to the selection, uncheck "Should this action be done for only the selected translations?", this option should affect to all translations
- Confirm the action and execute it
- It will only affect to the selected translation
Proposed resolution
Get the right value to avoid losing the user selection.