Find a more reliable way to determine if a form element concerns a multilingual value

Created on 31 July 2019, almost 6 years ago
Updated 11 February 2023, over 2 years ago

Problem/Motivation

Not all form elements are translatable, there is an array called $ignored_types in ContentTranslationHandler.php file have the following types ['actions', 'value', 'hidden', 'vertical_tabs', 'token', 'details'].
Some modules may add new types, like field_group module. So we need a better way to override this array or add more form elements to it.

Proposed resolution

Override this array in settings.php file, or find another better way to allow contrib modules to override this array or extend it.

Remaining tasks

Agree on approach
Write tests
Review code

User interface changes

None.

Data model changes

None.

Feature request
Status

Needs work

Version

10.1

Component
Content translation 

Last updated about 14 hours ago

No maintainer
Created by

🇯🇴Jordan Anas_maw

Live updates comments and jobs are added and updated live.
  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    So the proposed use case sounds like it would be better to have an alter hook to edit this variable?

    Tagging for subsystem maintainer review

    Either way it will require tests too.

  • 🇮🇳India nikhil_110

    Re-roll Patch #9 and interdiff file not generate...

    Patch #9 not applied
    - The following problem appears...
    ( error: patch failed: core/modules/content_translation/src/ContentTranslationHandler.php:563
    error: core/modules/content_translation/src/ContentTranslationHandler.php: patch does not apply )

  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    Re-roll Patch #13 due to Failed Patch.

  • Status changed to Needs review over 2 years ago
  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan
  • Status changed to Needs work about 2 years ago
  • 🇬🇧United Kingdom catch
    +++ b/core/modules/content_translation/src/ContentTranslationHandler.php
    @@ -564,11 +565,9 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
    -    //   multilingual value.
    -    if (!isset($ignored_types)) {
    +    if (empty($ignored_types)) {
           $ignored_types = array_flip(['actions', 'value', 'hidden', 'vertical_tabs', 'token', 'details', 'link']);
         }
    

    The default array of types can be in the default argument to Settings::get().

    Having said that, putting this in settings doesn't allow modules to alter it. I think it would be better as a container parameter or similar.

  • 🇩🇪Germany tstoeckler Essen, Germany

    There is #3109887: Find a more reliable way to determine if a form element concerns a multilingual value. also which tries to solve by making this an element property. This can be altered via hook_element_info_alter() which I think would be preferable to the setting and in my opinion is better suited for such a "niche" feature than a container parameter. Technically this issue precedes that one, so not sure if that one should be marked as a duplicate or if we should just continue there instead. Either way needs to be converted to a merge request and needs some tests.

Production build 0.71.5 2024