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

Created on 31 July 2019, about 5 years ago
Updated 17 February 2023, over 1 year 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 1 day 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 gujrat

    Re-roll Patch #13 due to Failed Patch.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year 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.

Production build 0.71.5 2024