Problem/Motivation

Problem 1:
Create a new content type 'foo' and set following settings:
- default language: Current interface language
- Show language selector
- Enable translation

Save the content type and edit again. The settings are back to default.

Problem 2:
In the settings of content language I marked 'Custom Block' to have custom language settings.
After that I'm creating a new custom block type (admin/structure/block/block-content/types).
I create a new block type with the label 'test', and don't change anything of language settings.
After submitting, i get following fatal error: Fatal error: Call to a member function setDefaultLangcode() on a non-object in .../core/modules/language/language.module on line 218

Proposed resolution

The submit is added to the 'submit' button. But when field ui is enabled, the button is 'save_continue'.
Adding a check if the field ui button is on the form, fixes the problem of the submit function being removed.
As an extra, the bundle is empty in the submit function. This causes the fatal error in problem 2. By making sure the bundle is always loaded through the form object, the correct bundle can be found.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nils.destoop’s picture

This patch fixes the fatal error by loading the bundle via the form object (option 2). Correct me if this is wrong :)

nils.destoop’s picture

Status: Active » Needs review
larowlan’s picture

Issue tags: +Needs tests

Thanks

askibinski’s picture

FileSize
128.87 KB

This patch fixed the first fatal error for the scenario as described in the issue topic, but it fails on a second one:

Fatal error: Call to a member function setThirdPartySetting() on a non-object in ../core/modules/content_translation/src/ContentTranslationManager.php on line 61

I figured out this second fatal error is only triggered when you add a block and do not check the "enable translation" checkbox (see screenshot).

nils.destoop’s picture

Content translation was not enabled here. When i enable the content translation, the same error is indeed occurring.

nils.destoop’s picture

Seems there is also a bug with adding a content type. The settings are not saving when adding a content type. That's the reason why this fatal error isn't occurring on that type.

I added a content type 'Language test' with translation enabled, and 'Show language selector' checked. After saving the first time, the settings are gone.

nils.destoop’s picture

Title: Fatal error in language_configuration_element_submit when creating a new block type if custom language settings are enabled. » Language / Translation settings are not saved when adding a new bundle.
Status: Needs review » Needs work
FileSize
4.12 KB

The main problem is being caused by field ui module. He is setting access to FALSE on the normal submit and creates a new submit button. All submit methods added in process are added on the wrong button.

Attached a patch that fixes the problem for both content types as block types. Now I'm gonna check for a test.

askibinski’s picture

There are a lot of "language-content, translatable fields" tagged issues, I wonder if this is related to any of those:
https://www.drupal.org/project/issues/search?text=&projects=&assigned=&s...

nils.destoop’s picture

Issue summary: View changes

This one mentioned the same problem #2328161: "Enable Translation" checkbox default non-predictable for new bundles, but only the default state was fixed there. But if you look at the steps, it matches this issue.

nils.destoop’s picture

Status: Needs work » Needs review
FileSize
2.97 KB
6.39 KB

Attached 2 patches. First patch are updated tests to show the bug (in language module and content translation). 2nd patch is the fix + the updated tests.

The last submitted patch, 10: translation_add_bundle_test-2408439-10.patch, failed testing.

rpayanm’s picture

Priority: Normal » Major
Issue tags: +D8MI
larowlan’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

thanks

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed f1766f9 and pushed to 8.0.x. Thanks!

  • alexpott committed f1766f9 on 8.0.x
    Issue #2408439 by zuuperman, askibinski: Language / Translation settings...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.