- Issue created by @joachim
- ๐ฎ๐ณIndia Akram Khan Cuttack, Odisha
added a patch and To improve the documentation for the FieldStorageConfig class, add a more detailed description of what the translatable property does and what it means when it's set to FALSE.
- last update
about 2 years ago 29,304 pass - Status changed to Needs review
about 2 years ago 7:34am 25 April 2023 - Status changed to Needs work
about 2 years ago 8:37am 25 April 2023 - ๐ฌ๐งUnited Kingdom joachim
+++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -129,7 +129,9 @@ class FieldStorageConfig extends ConfigEntityBase implements FieldStorageConfigI + * language on a multilingual site. If FALSE, the field is not translatable and + * will have the same value for all languages. *
My point though is that AFAICT this NEVER gets set to FALSE. There is no UI for it, and fields get created with it set to TRUE.
This needs input from people who know the deep innards of the translation system.
- ๐ง๐ชBelgium weseze
Could this be the default value, when "Adding an existing field" to a content type?
- ๐ฎ๐ณIndia priya.chat
Hey @weseze,
Answer to your question is No, this is not the default value set when "adding an existing field" to a content type. The translatable flag is a property of the field storage, not the field instance. This means it is defined once when the field is originally created and applies globally to that field across all bundles (content types, for example).When you add an existing field to another content type, Drupal uses the existing FieldStorageConfig definition, including its translatable setting. So the value of translatable is inherited from the original field storage configuration and cannot be changed for each individual instance.
- ๐ฎ๐ณIndia priya.chat
Adding a patch to update the doc block for translatable in FieldStorageConfig.
While the default is usually TRUE, it can be explicitly set to FALSE during field creation (especially via code). Once set, the value is fixed and governs the behaviour across all field instances โ the โTranslatableโ checkbox at instance level has no effect if the storage is non-translatable. Thanks.
- ๐ง๐ชBelgium weseze
It can be changed on a per instance basis... The config file for a field instance allows this. Also the translation interface for for example node-types > fields allows this.
The Needs Review Queue Bot โ tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request โ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)