When content translation is enabled, when you go to add a new field, there should be a checkbox indicating whether or not that field is translatable

Proposed resolution

A patch was written and tested to add that functionality

Remaining tasks

A number of wording and consistency issues needs to be resolved:
After it was brought up in #36 that 'Users' in 'Users may translate this field.' may be misinterpreted as 'Visitors', there were a few alternate language suggestions in #37.

Also, in comment #48, overlap between using 'enable translation' for checkbox and the 'Enable translation' link (+ confirmation + batch operation) was brought up: "The latter actually is a misnomer, since it doesn't just enable any translation, but instead, manipulates and updates all existing entities and field data values to have an explicit language assigned (and apparently, that's a dangerous operation that may lead to data loss, which is mentioned in code comments, but not at all in the UI)."

User interface changes

(New or changed features/functionality in the user interface, modules added or removed, changes to URL paths, changes to user interface text.)

API changes

None

CommentFileSizeAuthor
#81 1831608-translatable-field-81.patch4.74 KBpenyaskito
#81 interdiff.txt2.72 KBpenyaskito
#80 1831608-translatable-field-80.patch5.41 KBpenyaskito
#80 interdiff.txt2.28 KBpenyaskito
#78 1831608-translatable-field-78.patch3.13 KBjlbellido
#76 1831608-translatable-field-76.patch3.72 KBvijaycs85
#66 drupal8.translatable-field.66.patch6.09 KBswentel
#66 interdiff.txt3.54 KBswentel
#64 drupal8.translatable-field.64.patch5.33 KBswentel
#62 drupal8.translatable-field.62.patch5.33 KBGábor Hojtsy
#58 drupal8.translatable-field.58.patch574.99 KBpiyuesh23
#44 drupal8.translatable-field.43.patch5.95 KBsun
#44 translatable-language-disabled.png3.49 KBsun
#44 translatable-field-has-data.png3.65 KBsun
#44 translatable-field-has-data-remove.png4.33 KBsun
#41 hide_show_field_translatable-1831608-41-just-tests.patch2.92 KBYesCT
#41 hide_show_field_translatable-1831608-41.patch5.45 KBYesCT
#41 interdiff-33-41.txt1.97 KBYesCT
#34 1831608-test-only.patch2.95 KBsmiletrl
#34 hide_show_field_translatable-1831608-33.patch5.49 KBsmiletrl
#34 interdiff-30-33.txt975 bytessmiletrl
#31 hide_show_field_translatable-1831608-21.patch5.54 KBsmiletrl
#30 hide_show_field_translatable-1831608-test.patch3 KBsmiletrl
#30 field_translatable-1831608-18.patch2.56 KBsmiletrl
#23 nontranslatablebundle-2013-01-20_1950.png108.97 KBYesCT
#18 field_translatable-1831608-18.patch2.56 KBsmiletrl
#1 Screen Shot 2012-11-04 at 6.56.28 PM.png16.63 KBLukas von Blarer
#1 Screen Shot 2012-11-04 at 6.56.41 PM.png32.27 KBLukas von Blarer
#1 Screen Shot 2012-11-04 at 6.56.51 PM.png39.63 KBLukas von Blarer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lukas von Blarer’s picture

There are three steps in the create field worflow:

1. Choose field name and field type:

Screen Shot 2012-11-04 at 6.56.28 PM.png

2. Make global settings where "Field translation" and "Number of values" are missing:

Screen Shot 2012-11-04 at 6.56.41 PM.png

3. Make field instance settings where the global settings are available again with "Field translation" and "Number of values":

Screen Shot 2012-11-04 at 6.56.51 PM.png

IMO this setting should already be available on the second step. Is there a reason why both "Field translation" and "Number of values" are missing there?

Gábor Hojtsy’s picture

Component: entity system » translation_entity.module
Issue tags: -entity translation +D8MI, +language-content
plach’s picture

Issue tags: +Usability
Bojhan’s picture

Needs patch :) looks good.

plach’s picture

The reason is that the 2nd form is the field settings form. I think the difference between that one and the global settings in the main field form is that the field settings form is supposed to hold only values that cannot be changed. We could try to alter its behavior so that you can enter all global settings when creating the field.

-enzo-’s picture

Issue summary: View changes

Converted to Issue Summary Template standards

Gábor Hojtsy’s picture

@plach: I think that would be great, I always found it odd that you could only set certain things AFTER the field was created.

ancamp’s picture

Lukas von Blarer’s picture

So this is not really a D8MI issue?

Gábor Hojtsy’s picture

Lukas: yeah, I think it applies to field settings in general. The field UI is painful in many ways. It does surface with the entity translation setup as well painfully.

Lukas von Blarer’s picture

Component: translation_entity.module » field_ui.module
Issue tags: -D8MI, -language-content

So, I am moving this over there... Where can this be done?

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-content

It would be important to track for D8MI Usability, so let's keep the D8MI tags.

Lukas von Blarer’s picture

Status: Active » Postponed

This issue is related to #552604: Adding new fields leads to a confusing "Field settings" form I'll try to fix that one and then check back here, if this issue has been resolved.

Lukas von Blarer’s picture

Status: Postponed » Active

I provided a patch which solves this for me: http://drupal.org/node/552604#comment-6699446 Do you agree?

sun’s picture

It feels very odd that translation_entity module only alters this Field UI form (whereas Field UI is not necessary enabled to begin with), but does not massage field [type] info at all. In fact, this feels a bit like D6-era drupal_execute().

I'm aware that this issue focuses on the UI, but I wanted to make sure to mention that somewhere.

sun’s picture

Issue summary: View changes

Updated issue summary.

YesCT’s picture

Issue tags: +Novice

Next steps: re-evaluate if this is a closed (fixed) since #552604: Adding new fields leads to a confusing "Field settings" form is in.

If it's not closed, post the new current steps and screenshots (re-doing comment #1), and make a recommendation of what should be done.

plach’s picture

It's fixed: the checkbox is there, although it may have a different default depeding on the bundle translatability (leaving open for this).

xjm’s picture

Title: Add the "Make field translatable" checkbox on the add field form » Show or hide the "Make field translatable" checkbox on the add field form depending on translatability
smiletrl’s picture

A patch to decide whether to show/hide field translatable setting depends on if the entity/bundle this field attached is translatable. If this entity/bundle is translatable, then we show the field's translatable setting, otherwise hide it.

Remaining tasks:
'admin/config/regional/translation_entity/translatable/' . $field_name, this path probably needs to redfine its access callback.
These fields' translatable setting is associated with the field itself, not with field instance. So, this setting could be un-reliable if a field is attached to more than one enity/bundle. Also, this field's translatable setting could be confused with settings here 'admin/config/regional/content-language'.
see http://drupal.org/node/1893568 and http://drupal.org/node/1893596

smiletrl’s picture

Status: Active » Patch (to be ported)
smiletrl’s picture

Status: Patch (to be ported) » Needs review

sorry, choosed the wrong status:(

xjm’s picture

Issue tags: +Needs tests

This looks great!

+++ b/core/modules/translation_entity/translation_entity.moduleundefined
@@ -653,30 +653,37 @@ function translation_entity_form_field_ui_field_settings_form_alter(array &$form
+  // Only show field's translatable setting when entiy/bundle this field attached is translatable.

This comment is too long (it needs to wrap if it goes over 80 characters) and has a couple typos. Here's what I'd suggest:

Only show the field's translatable setting if the bundle is translatable.

Next let's add an automated test for this feature ensuring that the checkbox is shown or hidden appropriately when the bundle is translatable or not, including after making a change to the bundle. That will also help reviewers see if we are creating the correct behavior.

Also, what happens before this patch, if someone marks a field instance as translatable when the bundle is not?

plach’s picture

Well, a field instance can be shared among different entities and bundles, which may be translatable or not. Hence there is no real consistency check atm.

Btw, the migration code is going away as soon as we complete the conversion to the entity field API, so I wouldn't waste time on it.

YesCT’s picture

Steps to test.

  1. enable content translation
  2. add a language
  3. without enabling translation on any content type, add a field to see if make translatable shows.

OH! it does show.
nontranslatablebundle-2013-01-20_1950.png

smiletrl’s picture

@plach, hi,
need concept 'field instance' clarification here? I think field instance is a specific field attached to bundle. So, the same field could be attached to different bundles, and we get different field instances for this field. A good example is the default field 'Body' for page and article delievered with drupal core.This field 'Body' has two instances at this point.

a field instance can be shared among different entities and bundles, which may be translatable or not. Hence there is no real consistency check atm.

I guess this a field instance can be shared among different entities is not right?

Also, this check/patch in #1831608-18: Show or hide the "Make field translatable" checkbox on the add field form depending on translatability is to detect the bundle translatability, and try to keep field instance translatability(not the 'instance' concept you mentioned, but mine opinion^^ ) consistency with the bundle that the field instance attached.

I suppose it could be a better idea to make field translatability become a private/instance setting, but not a global setting. see issue #1893568-2: Make each field instance have its own translatable property, instead of sharing translatable property with others.

It makes sense to me that we should add this check here. But you are right, even as we show or hide field setting here, this field's translatable property could still be be changed in other places, simply because this transalatable setting is a global setting and shared with all other instances.

YesCT’s picture

I think we might be confusing each other with field instance terminology, making it seem like we are disagreeing, but really we are saying similar things.

it might be correct to rephrase @plach in #22

Well, a field instance can be shared among different entities and bundles, which may be translatable or not. Hence there is no real consistency check atm.

as:

Well, a field can be shared among different entities and bundles, which may be translatable or not. Hence there is no real consistency check atm.

plach’s picture

Yes, sorry, I meant just field. And I agree translatability should be per-instance, it'll make things simpler.

YesCT’s picture

@plach in #1893568-1: Make each field instance have its own translatable property, instead of sharing translatable property with others. it sounds like berdir had concerns that it's not possible to make translatability per-instance. Can you provide an outline there for how to approach the problem?

I think this can proceed just checking if the bundle is translatable. ... which is done in #18

So I think the Next Steps here is to improve that patch according to the feedback in #21

smiletrl’s picture

Assigned: Lukas von Blarer » smiletrl
Status: Needs review » Needs work

Let me try to add the test:)

smiletrl’s picture

Status: Needs work » Needs review
FileSize
2.56 KB
3 KB

This test works fine for me.

However, even as we could hide field translatable setting from field UI, this setting is still available at path:
'admin/config/regional/translation_entity/translatable/$field_name'
because current design is to set each field's translatability, not field instance's translatability.

It looks like we have to resolve #1893568: Make each field instance have its own translatable property, instead of sharing translatable property with others. at first, then this fix here will make sense.

smiletrl’s picture

docker’s picture

#31
It looks good, works as expected

YesCT’s picture

Status: Needs review » Needs work
+++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSettingsTest.phpundefined
@@ -119,4 +119,44 @@ protected function assertSettings($entity_type, $bundle, $enabled, $edit) {
+    // Create an extral field for content type article.
+    // At least one field needs to be translatable to enable article for
+    // translation. The extral field will be used for this purpose.

typo here "extral" also.. bit wordy.

suggestion (wrap it at 80 chars as needed):

+ // At least one field needs to be translatable to enable article for
+ // translation. Create an extra field to be used for this purpose.

---------

probably still needs a detailed code review.

when another patch is posted with fixes, include a test only patch version of that new patch. ([edit: added] and an interdiff to this patch)

smiletrl’s picture

Status: Needs work » Needs review
FileSize
975 bytes
5.49 KB
2.95 KB

Thanks for your review:)

YesCT’s picture

Status: Needs review » Reviewed & tested by the community

I did a code review. Looks good, if the testbot says it's green.

Dries’s picture

I'm confused by the 'Users may translate this field.'. I worry that 'Users' may be interpreted as 'Visitors'. I seems like we should be a bit more specific. I know it is not part of this patch, but this seems like a good time to discuss it.

YesCT’s picture

I looked for inspiration at:
admin/structure/types/manage/article comment settings and publishing options
admin/structure/types/manage/article/fields/field_image

Wording suggestions:

  1. Translatable
  2. Allow translation
  3. Enable translation

My favorite: 3: Enable translation
It's also the same wording that appears as a link which leads to a batch process for stuff that already has content
not 1, because it's already translatable (or else the checkbox wont show)
not 2, because that confused with permissions

YesCT’s picture

has tests.

YesCT’s picture

autocomplete problem with tags. restoring (hopefully)

alternate suggestion:

Enable translation on this field

plach’s picture

+1 for "Enable translation"

YesCT’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.97 KB
5.45 KB
2.92 KB

Enable translation

in tests and the module

sun’s picture

I think that @Dries' focus was on "Users".

Shortening the entire checkbox label into "Enable translation" leads to a very techy checkbox label, as it doesn't really clarify the effect of the checkbox anymore. As a user, I'd ask myself: Will it automatically translate? Does "translation" actually refer to linguistic translation or some other translation mechanism I don't know of yet?

Furthermore, "Enable" on a checkbox label is almost always unnecessary word clutter, since the checkbox form element itself is "a control to enable or disable something." So a plain and simple "Translatable" would be better than "Enable translation".


After looking at the patch, I think we could also be a little bit more helpful in case the entity type/bundle is not enabled for translation yet. E.g., making the checkbox #disabled, and adding a short #description that provides a short hint along the lines of:

[/] Translatable
    To enable translation of this field, <a href="@language-content-url">enable language support</a> for this bundle.
Gábor Hojtsy’s picture

Bundle? In user facing text?

sun’s picture

Status: Needs review » Needs work

The last submitted patch, drupal8.translatable-field.43.patch, failed testing.

smiletrl’s picture

For "Enable translation"

Will it automatically translate?

This is a good point. 'Translatable' could be a better option. But "Enable translation" is still used in other places, even in patch #44. I guess we could use words "enable translatability" in other places, but use "Translatable" for the checkbox label?

The main inspiration for patch before #41 is to ensure field instance's translatability depends on bundle's translatability, so we decide whether to show or hide field translatable setting. Patch in #44 provides helpful description for the label, but it seems to break this original incentive again:(

+    if (field_has_data($field)) {
+      $toggle_url = url('admin/config/regional/translation_entity/translatable/' . $field_name, array(
+        'query' => drupal_get_destination(),
+      ));
+      $form['field']['translatable']['#description'] = t('This field has data in existing content. <a href="@toggle-translatable-url">@toggle-label</a>.', array(
+        '@toggle-translatable-url' => $toggle_url,
+        '@toggle-label' => !$translatable ? t('Associate all field values with a language') : t('Remove language association from all field values'),
+      ));
+    }

This part says if the field has data, the field's translatability could be enabled at other place, no matter the bundle is translatable or not.

+    elseif (!$bundle_is_translatable) {
+      $toggle_url = url('admin/config/regional/content-language', array(
+        'query' => drupal_get_destination(),
+      ));
+      $form['field']['translatable']['#description'] = t('To enable translation of this field, <a href="@language-settings-url">enable language support</a> for this type.', array(
+        '@language-settings-url' => $toggle_url,
+      ));

This part says if the field doesn't have data, the bundle must be translatable firstly, and then this field could be enabled too.

The two parts lose consistency for users. Aslo, a more serious problem is, no matter the field has data or not, and no matter the bundle is translatable or not, this field's translatability could still be enabled at 'admin/config/regional/translation_entity/translatable/$field_name'

I don't think we have to create a new path to enable/disbale field translatability depending on the field has data or not. At least, right now, this path mixes the settings. We could simply make this checkbox also available for field that has data, but it could break the rule:There is data for this field in the database. The field settings can no longer be changed.

So, here are two possible solutions:

One is to remove all the field translatable setting from UI, except 'admin/config/regional/content-language'. We leave only one central place for users to enable the translatability for both bundles and fields. User will see obviously he/she has to enable bundle translatability then, he/she could enable field translatability. See #1893596: Can we remove field's own translatable setting from UI?

The other one is to attach field translatable setting to form field_ui_field_edit_form, instead of field_ui_field_settings_form. Just like implementing hook_field_instance_settings_form, we create extra field translatable setting for field instance, instead of field itself.

In this way, we could keep the field translatable setting for field UI, and don't need that evil/redundant path for field has data or not.
It also makes sense to have field translatable thing become per-instance. However, this would need much more work to be done, like change property $field['translatable'] to $field_instance['trabslatable']. If this approach could work, I think we could merge this issue to #1893568: Make each field instance have its own translatable property, instead of sharing translatable property with others., and wait for that issue be finished first.

YesCT’s picture

I think the new ideas since #42 should be a separate issue...

sun’s picture

Well, it's a bit long, but among other ideas, @smiletrl raises a few good points in #46.

Before this patch, the field settings form always exposed a control, but which actually isn't always available (due to two constraints elsewhere). The proposed solution of this issue was to hide the control entirely, if the preconditions are not met.

I think that's confusing. Because, sometimes, when I visit this settings form, the control would appear. And some other times, it would not. There wouldn't be any kind of indication for why, and no hint at all for how to get the control "back".

This is the main aspect I tried to fix in #44 — instead of hiding, provide a concrete hint and clue for why the control is not available currently.

Additionally, I had to dig really deep into the code to figure out what exactly the difference between the "Enable translation" checkbox and the "Enable translation" link (+ confirmation + batch operation) is. The latter actually is a misnomer, since it doesn't just enable any translation, but instead, manipulates and updates all existing entities and field data values to have an explicit language assigned (and apparently, that's a dangerous operation that may lead to data loss, which is mentioned in code comments, but not at all in the UI).

It is problematic to have two completely different operations with the same label, especially if one of them isn't guaranteed to be safe. That's why I reworded the labels of the links in #44, also clarifying what that operation is actually doing.

The main problem from my perspective is that this control requires multiple preconditions to be met, in order to be available and functional. If the preconditions aren't met, then they can be changed — but as a user, I don't know how and where. (I did not know this either, I had to study a bit of code to figure it out.)

Therefore, this precondition situation is not as simple as the typical case of, say, "Why is there no Preview button on my comment form?" — "D'oh, sorry, wasn't enabled." — Instead, due to the multiple layers and conditions, it requires concrete hints/guidance.

The only other option I can see would be to remove the checkbox entirely from the field settings form. Doing so inherently removes the user expectation that there can be a checkbox in the first place. Instead, translatability would have to be configured in a separate and central spot only. (However, upfront, I'm not a fan of that general direction, since I dislike the idea of having to perform bulk/mass configuration changes to everything on my site when in fact only a single field should be configured.)

plach’s picture

One thing I'd like to outline is that the data migration and the related route are going away as soon as we complete the ng conversion: once we are done the field values corresponding to the entity language will be always stored with the 'und' language code. This should solve part of the issues we are having here.

YesCT’s picture

I looked to see if we had a issue tracking the batch processing that happens when translation is enabled on content that already has data.
I looked in #1188388: Entity translation UI in core and #1836086: [meta] Entity Translation UI improvements but I didn't see anything exactly to address that. I imagine that issue would be postponed on one of the NG conversion issues.

maybe #1818580: [Meta] Convert all entity types to the new Entity Field API or #1732730: [meta] Implement the new entity field API for all field types

I'm going to update the issue summary with my best guess as to other issues this is kind of waiting on that will simplify this issue. If there are better issues to reference, or if we need one (like fix the batch translation enable once NG gets in), please make a comment.

YesCT’s picture

Issue summary: View changes

Updated issue summary next steps

patrickd’s picture

kkubali’s picture

Working on this issue at the Portland 2013 sprint.

kkubali’s picture

kkubali’s picture

Issue summary: View changes

tried to identify issues we are waiting on that will simplify this issue. -c

kkubali’s picture

Issue summary: View changes

updated issue summary

Pancho’s picture

Issue summary: View changes

Some reordering, corrections and linking the cited comments.

patrickd’s picture

@ kmharrell
please don't post issue updates as comments!
If you have a look on the top of the issue, there should be an "edit" link below the issue title.
Then you have to type in a change notice and all the changes on the issue summary will be revisioned.
(please edit you previous comment and make it empty so that this issue doesn't get too long!)
Also remove the "Needs issue summary update" tag after you updated the issue summary

Pancho’s picture

Thanks kmharrell, I reorganized the issue summary a bit and linked the comments. For now we can remove the tag.

klonos’s picture

Assigned: smiletrl » Unassigned

Not working on the issue for some months now - then better unassign.

jair’s picture

Issue tags: +Needs reroll

Needs reroll

piyuesh23’s picture

Assigned: Unassigned » piyuesh23
Status: Needs work » Needs review
FileSize
574.99 KB

Re-rolled the patch. Patch gets applied properly now. Attaching the re-rolled patch here.

Status: Needs review » Needs work

The last submitted patch, drupal8.translatable-field.58.patch, failed testing.

Gábor Hojtsy’s picture

Unfortunately does not pass anymore.

ceardach’s picture

Assigned: piyuesh23 » Unassigned

Something has gone wrong in this latest reroll. It appears as though the site-specific configuration has been included in the patch. Try reading through the reroll guide and see if that helps, https://drupal.org/patch/reroll

I've unassigned this issue since the patch is almost 2 months old. @piyuesh23, if you would like to still work on this reassign it back to yourself.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
5.33 KB

Same as #58 but without the unrelated stuff.

Status: Needs review » Needs work

The last submitted patch, drupal8.translatable-field.62.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
5.33 KB

rerolled - there were some changes here and there, but wasn't able to get a decent interdiff.

Status: Needs review » Needs work

The last submitted patch, drupal8.translatable-field.64.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
FileSize
3.54 KB
6.09 KB

And test fix - I changed the test also a little as the asserts didn't make any sense to me - feel free to correct me of course.

StuartJNCC’s picture

"Translatable" seems to me to be a very cryptic label for a checkbox and lacks a verb for the action you are deciding about. @sun objected to "Enable" because the presence of a checkbox suggests you are enabling or disabling anyway. So how about "Allow this field to be translated" - it is about the same length as the original ("Users may translate this field") but does clearly state what you are being asked to decide.

StuartJNCC’s picture

Issue summary: View changes

minor fix in the OP

Gábor Hojtsy’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

I think "Translatable" is as simple as it can get, and "Allow this field to be translated" is not clearer. I think the checkbox before "Translatable" clearly indicates that field translation is either turned on or off. This is the field settings form. I don't think repeating things like "this field" is helpful. All other settings are for "this field".

plach’s picture

Not sure how it plays with what we are doing here, but in #2076445: Make sure language codes for original field values always match entity language regardless of field translatability we are removing the field data migration as it will be always possible to switch field translatability.

Gábor Hojtsy’s picture

@plach: my understanding is even if the storage keying changes on fields, if a field was multilingual and is turned off, the data on different languages will not be accessible anymore. So similar logic will be needed but the wording will be slightly different.

IMHO that is a classic case of whichever patch lands later need to accommodate the change.

plach’s picture

Sounds sensible

Gábor Hojtsy’s picture

Issue tags: +sprint

Add on sprint for easier tracking.

klonos’s picture

Issue summary: View changes
Parent issue: » #1188388: Entity translation UI in core
Xano’s picture

webchick’s picture

Status: Reviewed & tested by the community » Needs work
vijaycs85’s picture

Status: Needs work » Needs review
FileSize
3.72 KB

Re-rolling #66

Status: Needs review » Needs work

The last submitted patch, 76: 1831608-translatable-field-76.patch, failed testing.

jlbellido’s picture

Status: Needs work » Needs review
FileSize
3.13 KB

Rerolled #76

Status: Needs review » Needs work

The last submitted patch, 78: 1831608-translatable-field-78.patch, failed testing.

penyaskito’s picture

Status: Needs work » Needs review
FileSize
2.28 KB
5.41 KB

Important chunks of code in #66 were missed in the rerolls.

penyaskito’s picture

FileSize
2.72 KB
4.74 KB

And now removed the checks for $field->hasData().

As #69 and #70 explain, there is no more field data migration so switching field translability is not dangerous anymore (#2076445: Make sure language codes for original field values always match entity language regardless of field translatability).

Gábor Hojtsy’s picture

Looks good to me, do you agree it looks good @plach?

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Looks good :)

tstoeckler’s picture

+++ b/core/modules/content_translation/content_translation.module
@@ -816,13 +816,27 @@ function content_translation_field_extra_fields() {
+    '#disabled' => !$bundle_is_translatable,

I might be wrong, but AFAIK #disabled does not actually prevent the form element from being submitted. I.e. if you hack the HTML to remove the 'disabled' attribute you can still check the checkbox and it will be saved. This could be prevented by (conditionally) setting '#value' on the element.

penyaskito’s picture

Status: Reviewed & tested by the community » Needs work

You are right.

swentel’s picture

Status: Needs work » Reviewed & tested by the community

Actually no. if the disabled property is set, user input will be ignored.

- edit - if the form api property is set, not some class or anything of course. Look in FormBuilder.php, line 1543 for the actual code and processing. This has been a feature of Form API since the very beginning.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Awesome, this looks like a great little UX improvement.

Committed and pushed to 8.x. Thanks!

Gábor Hojtsy’s picture

Issue tags: -sprint

Woot, thanks! Good to see this is finally done :)

Removing from sprint.

Status: Fixed » Closed (fixed)

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