Problem
From a standard profile English clean install
- Enable language module
- Go to /admin/config/regional/content-language
- Check custom language settings for "Content"
- Check "Show language selector on create and edit pages" for Article
- Save configuration
- Uncheck custom language settings for "Content" and don't uncheck "Show language selector on create and edit pages" inside article.
- Save configuration
Now you can see that the last uncheck is not saved and "Content" is still checked.
What I expect is that any language customization for "Content" is disabled.
As side note when content translation module is enabled and you have content types marked as translatable when you uncheck "Content" in the custom language settings the content stops being translatable and everything gets unchecked as expected.
Proposed resolution
Fix the form submit so the settings are saved regardless of the language selector settings.
Remaining tasks
Task | Novice task? | Contributor instructions | Complete? |
---|---|---|---|
Create a patch | YES | Instructions | YES |
Update the issue summary noting if allowed during the beta | YES | Instructions | YES - Should be okay |
Add automated tests | NO | Instructions | YES |
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards | NO | Instructions | NO |
Issue fork drupal-2575535
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
rodrigoaguileraAdded a related issue with similar problems
Comment #3
Gábor HojtsyBringing on sprint to investigate.
Comment #4
Gábor HojtsyRemoving from D8MI sprint due to inactivity. Raising to major though.
Comment #5
prasad_gogate CreditAttribution: prasad_gogate at Acquia commentedIssue is replicable
Verified on Drupal 8.0.2
Issue is, when checkbox for "content" from /admin/config/regional/content-language is de-selected and saved it does not reflected, this happens when you have sub-section "Show language selector on create and edit pages" is selected.
This happens since a child menu has a value you cannot remove the parent selection.
Comment #6
xjm(Updating issue credit for the major triage.)
Comment #7
heykarthikwithuworking on this.
Comment #8
heykarthikwithuchecked with the existing values of entity and settings.
Comment #10
SwapS CreditAttribution: SwapS commentedThis isn't solving the problem.
If you select any of the option in the content language setting and Submit the form without selecting any other content type specific configuration.
Drupal says 'Settings successfully updated.' but doesn't actually Save's the settings.
We probably should have a validate hook showing , clear message to the end user. (for better user experience )
Two of the other things :
1. Not sure how ,$existing_values = $form_state->getCompleteForm()['entity_types']['#default_value'] is helping.
Looking @ the codebase , it should have been : $form_state->getValues('entity_types') which return's an array . This array contains contains entity type's for which change is initiated.
Please correct me , if i am missing anything here.
2. For below piece of code
Here , Inner foreach run's irrespective of whether
.
I would recommend having , a condition check before updating the config object.
Something like :
Cheers,
SwapS
Comment #12
alexpottDiscussed with @catch, @xjm, @cottser and @effulgentsia. We discussed this and could only see a UI bug with no bad side effects on the site. Yes the behaviour is unexpected but nothing is badly broken. Therefore downgrading to normal.
@prasad_gogate thanks for confirming the bug still exists.
@Gábor Hojtsy, as you promoted this to major in #6, perhaps we're missing something - if we are - let's it promote back to major.
Comment #14
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commentedAnother report #2843672: Submitting "Content language" form does not apply any changes by @iancawthorne
Comment #15
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commentedComment #16
bighappyface CreditAttribution: bighappyface as a volunteer commentedAttached to this comment is a patch with a
BrowserTestBase
test demonstrating the bad behaviorComment #17
bighappyface CreditAttribution: bighappyface as a volunteer commentedAttached to this comment is a patch with the
BrowserTestBase
test from #16 as well as a proposed fix for resetting the content language default settings, particularly thelanguage_alterable
value. As the description indicates the "Show language selector on create and edit pages" checkbox has to be unchecked for an entity type configuration to be saved. This is due tolanguage_alterable
being enabled automatically with JS:http://cgit.drupalcode.org/drupal/tree/core/modules/content_translation/...
Assuming that the JS behavior is desired this patch will set the relative
language_alterable
setting toFALSE
when the whole entity type is disabled.Comment #20
bighappyface CreditAttribution: bighappyface as a volunteer commentedComment #21
alexpottComments in tests are good but this is probably a bit too much. The code almost says the same thing as the comment. Comments are important where it is not obvious. And yep this is subjective.
Also we don't really use the rootUser like this we tend to create users in tests that have the minimum permissions required. User 1 in Drupal land can sometimes have very different code paths to others.
Comment #22
bighappyface CreditAttribution: bighappyface as a volunteer commented@alexpott thank you for the feedback! I have updated the test per your guidance.
Comment #23
WidgetsBurritos CreditAttribution: WidgetsBurritos at Rackspace commented+1 LGTM
Comment #24
heykarthikwithu+1 RTBC
Comment #25
alexpottCommitted and pushed 4229a76 to 8.4.x and 4a31c0d to 8.3.x. Thanks!
I've backported this to 8.3.x since this change is patch release safe.