The admin/config/regional/content-language page lists the "translatable" status of bundles and of each field within the bundles. If fields are not translatable, they are not checked. However, the default behaviour of the javascript is to toggle the "translatable" status of bundles between all enabled and all disabled. Therefore, if a user were to load the page and inadvertently (or "experimentally") uncheck and re-check the checkbox for the bundle, they'd end up with all the field being set to "translatable". They may not notice (and know that they can just reload the page to see the true configuration again) and could potentially save some changes unintentionally.

Solution: toggle back to the original/true settings

Steps to reproduce

  • visit admin/config/regional/content-language
  • enable translation for the content type and for all fields except one (other than the file field which is already disabled), save form
  • note that the field that is faithfully showing as unchecked after reload
  • click on the checkbox to disable translation for the content type and immediately re-check the box
  • note that the field that is not showing as checked after the click
  • if you save now, you will have changed the settings... perhaps without even noticing
CommentFileSizeAuthor
#6 2492541-6.patch14.03 KBjanicevn

Comments

omar’s picture

Title: Toggling translatability shouldn't forget settings on admin page » Toggling translatability on admin page shouldn't forget settings
omar’s picture

Issue summary: View changes
omar’s picture

Issue summary: View changes
omar’s picture

Issue summary: View changes
janicevn’s picture

Assigned: Unassigned » janicevn
janicevn’s picture

Status: Active » Needs review
StatusFileSize
new14.03 KB

Status: Needs review » Needs work

The last submitted patch, 6: 2492541-6.patch, failed testing.

The last submitted patch, 6: 2492541-6.patch, failed testing.

thenchev’s picture

This is mostly a git problem. Do again the commit without a/core/modules/language/src/Form/NegotiationConfigureForm.php

Also take care of some code styling problems like:

+++ b/core/modules/content_translation/content_translation.admin.js
@@ -84,6 +84,7 @@
     attach: function (context) {
+      var arrayIdClickedChecboxes =  []; ¶
       // Initially hide all field rows for non translatable bundles and all

Space at the end.

+++ b/core/modules/content_translation/content_translation.admin.js
@@ -106,13 +107,18 @@
         if ($target.is(':checked')) {
+          if ( arrayIdClickedChecboxes.indexOf($target[0].id) == -1 ) {            ¶
+            $fieldSettings.find('.translatable :input').prop('checked', true);
...
+        if ( arrayIdClickedChecboxes.indexOf($target[0].id) == -1 ) {

There should be no space between parenthesis and arrayIdClickedChecboxes

+++ b/core/modules/content_translation/content_translation.admin.js
@@ -106,13 +107,18 @@
         }
+        if ( arrayIdClickedChecboxes.indexOf($target[0].id) == -1 ) {
+          arrayIdClickedChecboxes.push($target[0].id);

Same here.

Version: 8.0.0-beta10 » 8.0.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.0.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 9.2.x-dev
Issue tags: +Bug Smash Initiative

@omar, Thanks for reporting this issue. We rely on issue reports like this one to resolve bugs and improve Drupal core.

I tested this on 9.2.x on a fresh standard install and was not able to reproduce the problem. I followed the steps from the IS, repeated here.

  1. visit admin/config/regional/content-language
  2. enable translation for the content type and for all fields except one (other than the file field which is already disabled), save form
  3. note that the field that is faithfully showing as unchecked after reload
  4. click on the checkbox to disable translation for the content type and immediately re-check the box
  5. note that the field that is not showing as checked after the click
  6. if you save now, you will have changed the settings... perhaps without even noticing

At step 5 the field (a plain text field I added to the article content type) that was unchecked was now checked.

Therefore, closing as cannot reproduce. If you are experiencing this problem reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").

Thanks!

quietone’s picture

Status: Needs work » Closed (cannot reproduce)