Active
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
24 May 2016 at 02:05 UTC
Updated:
28 Sep 2021 at 07:21 UTC
Jump to comment: Most recent
When in translation mode, the non-translatable (shared) fields should be hidden.
IEF code:
if (!empty($entity_form['#translating'])) {
$langcode_key = $this->entityType->getKey('langcode');
// Hide the non-translatable fields.
foreach ($entity->getFieldDefinitions() as $field_name => $definition) {
if (isset($entity_form[$field_name]) && $field_name != $langcode_key) {
$entity_form[$field_name]['#access'] = $definition->isTranslatable();
}
}
}
Comments
Comment #2
berdirThis is related to #2463575: Wrong "all languages" in multilingual paragraphs
As @bojanz and I found out today, core switches dynamically between showing all fields with "All languages) suffixes and hiding them based on whether a user has permission to edit the original translation (He originally thought it is based on edit or add translation, but it's actually the permission).
Given that we're in an embedded case where space is always an issue, I'm leaning towards doing the same as IEF and hiding all fields. If there is a use case for showing them we can always add a new option and make it configurable.
Both issues will touch the same code, wondering if we want to work on them together.
Comment #3
agoradesign commentedI've noticed this problem yesterday with IEF: #2734623: Untranslatable boolean fields having FALSE as their original value cause EntityStorageException
I guess, it has to do with hiding the untranslatable fields, although this still looks strange and shouldn't be. Anyhow, you should try and test this scenario with Paragraphs too, once you've implemented that
Comment #4
luksakI think parahraphs should follow the same pattern nodes do. This means not hiding untranslatable field except for certain edge cases (Eg. not having the edit permission, but the translate permission). Hiding fields is not going to be less confusing. The "(all languages)" label added by core should be improved in way that is clear and self-explanatory.
Comment #5
miro_dietikerI just opened a long-overdue issue about hiding shared actions while translating: #2932344: [META] Hide shared actions when translating
Once this is fixed, the next item to discuss translation wise is hiding shared fields, at least optionally. Also core currently discusses how to improve the indication of these fields.
Comment #6
anybodyMight this issue be related? #3239576: Multilingual paragraphs: "[HIDDEN TRANSLATED] field is required. " if hidden subfield is required Also for others who may run into that problem...