Argument #3 ($currentTranslationOnly) must be of type bool, null given

Created on 1 August 2023, 11 months ago
Updated 3 August 2023, 11 months ago

Problem/Motivation

When selecting items and then the action "Unpublish Current Revisions" it then asks on a second page:

> Should this action be done for only the selected translations?
> If unchecked it will apply to all translations of the selected content.

After applying it then goes to the Execute Action screen and then, whichever way the selected translations option was selected, it seems to forget the answer and crash out in a blaze of glory.

Showing in the error logs:

Got error 'PHP message: TypeError: Drupal\\moderated_content_bulk_publish\\AdminModeratedContent::unpublish(): Argument #3 ($currentTranslationOnly) must be of type bool, null given, called in /var/www/html/web/modules/contrib/moderated_content_bulk_publish/src/Plugin/Action/UnpublishCurrentRevisionAction.php on line 44 in /var/www/html/web/modules/contrib/moderated_content_bulk_publish/src/AdminModeratedContent.php on line 274 #0 /var/www/html/web/modules/contrib/moderated_content_bulk_publish/src/Plugin/Action/UnpublishCurrentRevisionAction.php(44): Drupal\\moderated_content_bulk_publish\\AdminModeratedContent->unpublish(NULL, NULL, NULL)\n#1 /var/www/html/web/modules/contrib/views_bulk_operations/src/Action/ViewsBulkOperationsActionBase.php(67): Drupal\\moderated_content_bulk_publish\\Plugin\\Action\\UnpublishCurrentRevisionAction->execute(Object(Drupal\\portside\\Entity\\ArticleNode))\n#2 /var/www/html/web/modules/contrib/views_bulk_operations/src/Service/ViewsBulkOperationsActionProcessor.php(471): Drupal\\views_bulk...', referer: https://portside.ddev.site/batch?id=272&op=start

And in the UI:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /batch?id=267&op=do_nojs&op=do
StatusText: OK
ResponseText:

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mlncn
  • Status changed to Needs work 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    Here is a patch that works around the problem. The requested value is still 'stored' as NULL for some reason, but this fallback substitutes the default FALSE in that case.

    Whichever way a person selects the option to do it only for "selected translations" will be ignored, and it will be done for all translations of the selected content.

    This is good enough for me, and maybe there should be different actions for "all translations" and "selected translations" to remove the annoying and not working anyway second selection page.

  • Status changed to Fixed 11 months ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Thank you!

  • Status changed to Needs work 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    Thanks but what i did was definitely a workaround!! Not a fix! Also was coming back to post a patch that covers publish and unpublish. Still a workaround, does not address the configuration not being saved properly in intermediate step for use in final step.

  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    This line:

    $config = \Drupal::config('moderated_content_bulk_publish.settings');

    would seem to be what's wrong?

    The setting was done on the bulk operations form, not from the settings form (which does have a related setting that would be the appropriate fallback i guess, not my 'false', of current_translation_only_default_value).

    Again the easiest solution i can think of that might also improve user experience is to have unpublish_all_translations and unpublish_selected_translations as separate options.

  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    ok I'll revert it as soon as the git repo comes back.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    @mlncn, if you figure this issue out, please let us know.

    Seems like it must be related to configuration options and translation settings? Otherwise others would likely have raised an issue sooner?

Production build 0.69.0 2024