Caution, this is not a simple issue to work on, its category of "normal" is not the difficulty, but a measure of its impact.
Problem/Motivation
Image fields have a Title and Alt sub-fields. Both sub-fields are optional and translatable, but enabling/disabling each sub-field does not show/hide the corresponding translation controls. This is confusing, especially because Alt is enabled by default, but Title is not.
Proposed resolution
- When editing an image field, use Form API states to hide the Alt checkbox in the Translatable elements list when the Enable Alt field checkbox is unchecked.
- When editing an image field, use Form API states to hide the Title checkbox in the Translatable elements list when the Enable Title field checkbox is unchecked.
- When editing an image field, display a message ("Disabled fields are not shown. Please first enable the fields you need to make translatable.") below the Translatable elements list if any Translatable elements checkboxes are being hidden.
- On the Content language settings page at
admin/config/regional/content-language
, hide the Alt checkbox if Enable Alt field is unchecked. - On the Content language settings page at
admin/config/regional/content-language
, hide the Title checkbox if Enable Title field is unchecked. - On the Content language settings page, display a message ("Disabled fields are not shown. Please first enable the fields you need to make translatable.") if any checkboxes are being hidden.
Note that testbot cannot run front-end tests automatically (see #2232271: [Meta] Use Behat for validation testing or #2229187: SiteEffect: Automated frontend regression testing, also #825436: Create selenium-RC PIFR plugin for full functional testing).
Aside: should this issue be split into two?
It's been suggested the issue be split into two issues: one to change the image field edit page, and one to change the Content language page.
The problem with splitting into two issues is that whichever one is fixed first might be broken by trying to fix the other, and we wouldn't know because we don't have tests (this happened at some point in working on this issue).
Remaining tasks
Wait for #2290849: Regression: Fields missing from translation overview since "Clarify handling of field translatability".Determine whether it is necessary to announce to screenreaders when the checkboxes are shown/hidden.- Decide whether to postpone this issue until we have automatic front-end tests.
- Write front-end tests.
- Show/hide checkboxes on the image field edit page, and announce this to screenreaders.
Display a warning when checkboxes are being hidden on the image field edit page.- Show/hide checkboxes on the Content language settings page, and announce this to screenreaders.
- Display a warning when checkboxes are being hidden on the Content language settings page.
- Usability review.
Steps to reproduce
- Install a fresh Drupal 8.0 site using the Standard install profile (
drush -y site-install standard
). - Enable the Content Translation module (
drush -y pm-enable content_translation
). - Go to
admin/config/regional/language
and add a second language. - Go to
admin/structure/types/manage/article/fields/node.article.field_image
.- There is a checkbox labeled "Enable Alt field". It is checked by default.
- There is a checkbox group titled "Translatable elements", containing a checkbox labeled "Alt". It is checked by default.
- There is a checkbox labeled "Enable Title field". It is unchecked by default.
- Expected behavior:
- There is no checkbox labeled "Title" in the "Translatable elements" checkbox group. There is a message saying "Disabled fields are not shown. First enable the fields before changing their translatable setting."
- Actual behavior:
- There is a checkbox group titled "Translatable elements", containing a checkbox labeled "Title". It is checked by default.
- Uncheck the checkbox labeled "Enable Alt field".
- Expected behavior:
- The checkbox labeled "Alt" in the "Translatable elements" checkbox group disappears.
- The message "Disabled fields are not shown. First enable the fields before changing their translatable setting." stays visible.
- Actual behavior:
- The checkbox labeled "Alt" in the "Translatable elements" checkbox group stays visible.
- No message is shown.
- Expected behavior:
- Check the checkbox labeled "Enable Alt field".
- Expected behavior:
- A checkbox labeled "Alt" in the "Translatable elements" checkbox group appears. It is checked by default.
- The message "Disabled fields are not shown. First enable the fields before changing their translatable setting." stays visible.
- Actual behavior:
- The checkbox labeled "Alt" in the "Translatable elements" checkbox group stays visible.
- No message is shown.
- Expected behavior:
- Check the checkbox labeled "Enable Title field".
- Expected behavior:
- A checkbox labeled "Title" in the "Translatable elements" checkbox group appears. It is checked by default.
- The message "Disabled fields are not shown. First enable the fields before changing their translatable setting." disappears.
- Actual behavior
- The checkbox labeled "Title" in the "Translatable elements" checkbox group remains visible.
- No message is shown.
- Expected behavior:
- Uncheck the checkbox labeled "Enable Title field".
- Expected behavior:
- The checkbox labeled "Title" in the "Translatable elements" checkbox group disappears.
- The message "Disabled fields are not shown. First enable the fields before changing their translatable setting." appears.
- Actual behavior
- The checkbox labeled "Title" in the "Translatable elements" checkbox group remains visible.
- No message is shown.
- Expected behavior:
- Check the checkbox labeled "Enable Title field".
- Click
Save configuration
. - Go to
admin/config/regional/content-language
. In the Custom language settings checkbox group, checkContent
. In the Content table, check theTranslatable
checkbox for the Article content type.- A list of fields available for translation appears.
- Under "Article" -> "Image", the "File" checkbox is unchecked.
- Under "Article" -> "Image", the "Alt" checkbox is checked.
- Under "Article" -> "Image", the "Title" checkbox is checked.
- No message is shown.
- Go to
admin/structure/types/manage/article/fields/node.article.field_image
. - Uncheck the checkbox labeled "Enable Title field".
- Uncheck the checkbox labeled "Enable Alt field".
- Click
Save configuration
. - Go to
admin/config/regional/content-language
. In the Custom language settings checkbox group, checkContent
. In the Content table, check theTranslatable
checkbox for the Article content type.- A list of fields available for translation appears.
- Under "Article" -> "Image", the "File" checkbox is unchecked.
- Expected behavior:
- Under "Article" -> "Image", there is no "Alt" checkbox.
- Under "Article" -> "Image", there is no "Title" checkbox.
- The message "Disabled fields are not shown. First enable the fields before changing their translatable setting." is shown.
- Actual behavior:
- Under "Article" -> "Image", the "Alt" checkbox is checked.
- Under "Article" -> "Image", the "Title" checkbox is checked.
- No message is shown.
User interface changes
- When editing image field settings:
- Hide the Alt checkbox in the Translatable elements list when the Enable Alt field checkbox is unchecked.
- Hide the Title checkbox in the Translatable elements list when the Enable Title field checkbox is unchecked.
- Display a message when a checkbox is being hidden from the Translatable elements list.
- On the Content language settings page:
- Hide the Alt checkbox in the list of fields when the Enable Alt field checkbox is unchecked in the field settings.
- Hide the Title checkbox in the list of fields when the Enable Title field checkbox is unchecked in the field settings.
- Display a message when a checkbox is being hidden from the list of fields.
API changes
None.
(If problems are discovered in the config storage, that will be filed in a separate issue)
Comment | File | Size | Author |
---|---|---|---|
#107 | homepage-new.feature.txt | 3.9 KB | kgoel |
#106 | tinybit.feature.txt | 587 bytes | kgoel |
#105 | homepage-new.feature.txt | 533 bytes | kgoel |
#100 | alt-title-not-translatable-aware.jpg | 37.73 KB | mgifford |
#100 | alt-tilte-translatable-elements-content-language.png | 6.93 KB | mgifford |
Comments
Comment #1
YesCT CreditAttribution: YesCT commentednot major.
Comment #2
YesCT CreditAttribution: YesCT commentedalso not a feature request :)
Comment #3
YesCT CreditAttribution: YesCT commentedsteps to reproduce:
Comment #4
YesCT CreditAttribution: YesCT commentedNote the system is working as it should.
The disconnect is in the expectations of the person setting up translation.
Both in the language and translation overview settings screen: admin/config/regional/content-language
and in the field settings (which is the image in the issue summary): admin/structure/types/manage/article/fields/field_image
Those show "title" checked (able to be checked) when title is not enabled on the field.
So the proposed solution here is to add some code to hide the title from the translation settings if title is not enabled for the field.
And more generically, to hide alt if it's not enabled on the field
And if we can be even more generic so this works for other fields besides images that have various parts to them.
Comment #5
e0ipsoI've been experimenting a bit with this and I have found the following.
Both regional settings and field settings use the same function to populate the list of available column groups (
translation_entity_field_sync_widget
), when the Translatable elements checkboxes are generated (and default values set).The proposed patch is for translation_entity because it tries to fix this for generic fields. The restriction is the key of the field being the same as the translation checkbox key (or adding "_field" to it).
Comment #6
e0ipsoComment #7
YesCT CreditAttribution: YesCT commentedI think we should either
1) also add a note to the disabled field explaining why it cannot be made translatable? and where to enable it, ... we can generate a link to the mangage fields tab, since we know what kind of content it relates to, right?
or
2) just hide it. If people knew a title was a possible field, they would probably also know where to enable it (so no hint needed to tell them where to do it)
Comment #8
YesCT CreditAttribution: YesCT commentedI looked at the code for coding style stuff and it looks excellent. :)
Comment #9
e0ipsoAdded some feedback to the user in the form description.
The checkboxes are now hidden and disabled if the field is not checked as enabled.
Comment #10
robertgarrigos CreditAttribution: robertgarrigos commentedWorks as expected. However needs some wording ("Disabled field are not shown" -> "Disabled fields are not shown")
Comment #11
e0ipsoCorrected typo.
Comment #12
YesCT CreditAttribution: YesCT commentedupdating tags.
Next:
See contributor task doc on manual testing: http://drupal.org/node/1489010
Comment #13
e0ipsoUpdated patch to work on
admin/config/regional/content-language
.Browser coverage
This patch has been tested and proven to work under the following browsers.
Scenario 1
All elements for the image field (article node bundle) are enabled.
Image settings (all available)
Content language settings (all available)
Scenario 2
Title element is unckecked in the image settings page.
Title element is not show.
Disable title element and then save. Navigate to content language settings.
Comment #15
killua99 CreditAttribution: killua99 commentedFixing the patch to allow this feature.
I review it and seen like it's a small but useful feature.
Comment #17
e0ipsoPatch in #15 from killua99 is a reroll of #13 from e0ipso. There are no differences to review.
Comment #18
e0ipso#15: drupal-hide-title-and-alt-groups-1920876-15.patch queued for re-testing.
Comment #19
YesCT CreditAttribution: YesCT commentedI dont see where this phrase shows in the screenshots.
This comment does not make sense.
Is it meaning:
"Synchronize the display checkbox for fields to enable translation of with those enabled in the content type."
Or something like that? I'm not sure what "column" is. (Maybe retitle the function.) If that is close, it needs some rewording still, as what I wrote is awkward.
Also, "sync" might mean something else in other code in terms of having a field (a field within a field) be the same in every translation.
Comment #20
e0ipsoRe-wording and additional screenshot.
Comment #21
e0ipsoComment #21.0
e0ipsoUpdated issue summary.
Comment #22
YesCT CreditAttribution: YesCT commentedon the overall language content settings configuration page, there is no message saying some fields are hidden, and no link to enable them. This might be ok...
go there, and save, then go to the content type manage fields and edit the image field.
--------
here, the added message is strange. moving the "first" word helps a bit, but it's still odd.
Also, I think the message should only be shown *if* some fields are hidden?
And... the title field is *not* hidden, it should be (or at least the message says it should be hidden.)
This page will make more sense if the translatable checkboxes are *after* the area where the fields are enabled/disabled. or at least nearer to those.
patch changes the helptext wording a bit.
needs review to let the bot run on it.
but needs work, to make the field actually be hidden when it's not enabled.
Comment #23
YesCT CreditAttribution: YesCT commentedneeds work because in the manage fields -> edit for image the disabled fields need to be hidden (and maybe the translatable group moved down nearer to the enabling checkboxes)
Comment #24
e0ipsoThere was some code that got lost in the re-roll that happened in #15 that caused the bug described in #23.
Comment #25
e0ipsoComment #26
bookmarvel CreditAttribution: bookmarvel commentedim about to test this patch
Comment #26.0
bookmarvel CreditAttribution: bookmarvel commentedUpdated issue summary.
Comment #27
bookmarvel CreditAttribution: bookmarvel commentedi followed the steps to reproduce.
the patch is better because the title is hidden, but the group of checkboxes is not moved down.
Comment #28
e0ipsoI don't think we can move the checkboxes down after the required checkboxes. This patch attempts to work not only for the image case, but for other cases too.
Is this fact a blocker?
Comment #29
YesCT CreditAttribution: YesCT commentedDo we have any other case we can look at?
I think in other cases, we would still want it below.
Comment #30
Gábor HojtsyComment #31
bannorb CreditAttribution: bannorb commentedI followed reroll (https://drupal.org/patch/reroll) and made a new patch. I haven't tested it.
Comment #32
e0ipsoAfter talking with @YesCT in Prague, we decided to position the Translatable elements at the bottom as an special case for the image module.
Comment #33
YesCT CreditAttribution: YesCT commentedthe structure, content types, article, manage fields, image
works!
and the translatable section is after we pick if we want it or not. :) it is coded as a special case of images, and I think that is fine.
without enable title, the place to enable translation of title is hidden.
with enabled, we can see it to enable it.
but... I tried the other page
it used to work... see first screenshot in #22 that on the content language settings page, that when title is not enabled, that the title will be hidden, so we do not try and enable translation for it.
Comment #33.0
YesCT CreditAttribution: YesCT commentedMade steps to reproduce from comment 3
Comment #34
klonosComment #35
Schnitzel CreditAttribution: Schnitzel commentedcleaning up assigness
Comment #36
sidharthapUpdating issue tag. Will have a look at Drupal Camp Mumbai sprint on this weekend.
Comment #37
klonos@sidharthap: did you intentionally remove those tags along with the one you've added Sidhartha or did the tag monster actually survive the d.o D7 upgrade? If not intended, please add them back. Thanx.
Comment #38
sidharthapI just updated the tag and unsure how the old tags gets deleted.
Comment #39
klonos...adding accidentally removed tags back then (most of them - not sure if "#SprintWeekend" will be added because of #2171455: d.o does not autocomplete tags starting with # hash anymore).
Comment #40
alimac CreditAttribution: alimac commentedPatch in #32 needs rerolling.
Comment #41
alimac CreditAttribution: alimac commentedOne conflict was auto-merged. Another conflict had a lot of context changes.
Comment #42
YesCT CreditAttribution: YesCT commentedI think this is needs work, because the last testing in #33 showed that when the title was not enabled, making it translatable on manage fields for a content type was hidden, but it was still shown on the content translations settings page. It should be hidden there.
Next manual tester, please try that, and also making sure other disable-able fields are hidden. Make sure the alt field works similarly (it should be hidden in the translatable enable area when it's not enabled as a field for the content type field setting).
Should we write a simple test web test to make sure disabled fields dont show on both the content type manage fields settings and also the content translation settings overview page?
Comment #43
klonosComment #44
jlbellidoI'm going to test manually #41
Comment #45
jlbellidoI've tested #41 and unfortunally text field still available for be translatable if we have disbled it:
Before apply #41:
After apply #41:
Image field settings in both cases:
I'm going to see what's happening.
Comment #46
jlbellidoI've fixed some of the following things from #41:
After remove this changes from #41, it still not working :-(. The problem is that 'translation_sync_options' setting isn't arriving to the behaviour. The translation_sync_options setting is set at the 'content_translation_field_sync_widget' function but it doesn't arrive to the behaviour. After a day searching why is happening this, I couldn't find why.
I attach a new patch with the fixes from #41.
Remaining tasks
- Find why this isn't working.
- Next manual tester and, make sure the alt field works similarly (it should be hidden in the translatable enable area when it's not enabled as a field for the content type field setting).
- Add tests.
Comment #47
javisr CreditAttribution: javisr commentedI'm working on this issue
Comment #48
javisr CreditAttribution: javisr commentedComment #49
javisr CreditAttribution: javisr commentedRe-rolled.
I will continue with this issue
Comment #50
heddnComment #51
javisr CreditAttribution: javisr commentedI give it up
Comment #52
jsbalseraWorking with @javisr on it, it seems that it wasn't checking if the alt and title where enabled or not. Probably it's not the right way to do it, but at least it seems to work, although I'm not sure that it's working the way it should when we save the admin/config/regional/content-language form.
Comment #54
javisr CreditAttribution: javisr commentedComment #55
javisr CreditAttribution: javisr commentedHi!
To try what is happening with the test I need to undestand very well what are the expected behaviors.
I write here the testcases of the behavior that i undestood but i dont know if it is well.
[A]: Enable Title field
Enable Alt field
[B]: Image
File
Alt
Title
[1] /admin/config/regional/content-language
[2] /admin/structure/types/manage/article/fields/node.article.field_image?destination=admin/structure/types/manage/article/fields/node.article.field_image
As I understood, while [A] should only appear in [2], [B] should appear in both forms.
The behaivor that I should expect is the next one:
By Default:
- go to [2]
- [A] should appear unchecked
- [B] shouldn't appear.
- go to [1]
- [B] should appear without childrens.
[A] is going to be checked in [2]:
- go to [2]
- check [A]
- [B] should appear unchecked.
- go to [1]
- [B] should appear unchecked.
[A] is checked in [2]:
- [B] should appear in [1] & [2]
- Change any of then
- it should be also change in the other one.
Uncheck [A] in [2]:
- [B] shouldn't appear in [1] and [2]
Could someone confirm if this is the expected behavior please :)
PS: Im sorry about my poor English.
Comment #56
YesCT CreditAttribution: YesCT commented[A]: Image
[A][t] Enable Title field
[A][a] Enable Alt field
[B]: Image
[B][f]File
[B][a]Alt
[B][t]Title
[1] /admin/config/regional/content-language
[2] /admin/structure/types/manage/article/fields/node.article.field_image?destination=admin/structure/types/manage/article/fields/node.article.field_image
---------
Behavior of the translation settings [B] in both [1] and [2] should always be the same.
---------
When
[A][t] is unchecked (not enabled) in [2], then [B][t] should not appear in [1] and should not appear in [2]
When
[A][a] is unchecked (not enabled) in [2], then [B][a] should not appear in [1] and should not appear in [2]
Writing the same another way:
When
[A][t] is disabled in [2], then [B][t] should be hidden in [1] and [2]
When
[A][a] is disabled in [2], then [B][a] should be hidden in [1] and [2]
Also same another way:
Writing the same another way:
When
[A][t] is enabled (checked) in [2], then [B][t] should be shown in [1] and [2]
When
[A][a] is enabled (checked) in [2], then [B][a] should be shown in [1] and [2]
Hope that helps.
Comment #57
YesCT CreditAttribution: YesCT commentedtagging with javascript tag, since this touches javascript files (and #2219493: Add search for issues with patches that touch certain file types (javascript, css, ...) or files doesn't have a solution yet)
tagging with needs tests. :) since this needs tests to both make sure it doesn't break in the future and to do a better job of communicating expected behavior within this issue.
Just for good measure, contributor task doc on adding automated tests: https://drupal.org/contributor-tasks/write-tests
---
So, the previous patch(es) do not change tests.
We might need to change tests or add tests.
in irc @javisr said might have some time later to look at tests. to help with that, I tried to locate other tests we might be able to add to or copy from.
since it deals with the content language settings page..
ag "admin/config/regional/content-language" core
shows tests in:
core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php
core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php
core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
ideally, the test would use a generic content type and field, and not specifically article, but we can start with article if that is easier.
core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php around line 578 might also be useful to look at as an example of tests dealing with the field ui.
Comment #58
killua99 CreditAttribution: killua99 commentedMy chance,
Is not so magic, cause the object are diff and make it really hard to handle with JS to hide and show up the checkbox, is better and more secure show or hide the checkbox after submit any post.
This are the obj.
http://drupal8.dev/admin/structure/types/manage/article/fields/node.arti...
Drupal\field\Entity\FieldConfig
http://drupal8.dev/admin/config/regional/content-language
Drupal\field\Entity\FieldInstanceConfig
So the settings are a little diff, that's the reason is so hard to handle with JS.
This is a different way to handle this issue, hope help to solve it.
Comment #59
killua99 CreditAttribution: killua99 commentedchange status...
Comment #60
YesCT CreditAttribution: YesCT commentedwah?!
I'll try this out live to see how it feels.
Comment #61
YesCT CreditAttribution: YesCT commentedRe patch in #58 http://screencast.com/t/eLZaHoRKbDku
My feeling is that if we do not do this in js (showing/hiding the translatable checkbox as soon as it the enabled is toggled), then we should just leave it showing there all the time.
Maybe it only makes sense to hide/show it on the content language/translation settings overview page? (with a warning that only enabled fields are show?)
Tried #58 again http://screencast.com/t/jDEG3AhGS0
#52
http://screencast.com/t/jDEG3AhGS0
#52 is very close. the title or alt are hidden or shown on both [2] the content type manage fields page and [1] the translation overview settings page as they are disabled or enabled on [2] the content type manage fields page
But, as can be seen at 1:28 in the screencast, the very first time the translation settings are shown on [1], it is not realizing that title is not enabled.
[edit:]
Another problem with #52
http://screencast.com/t/EHe3bdsUaZ
the translatable checkbox on the manage fields tab is always shown as checked, even if the setting was saved to have it not be translatable. (the setting seems to be ok on the [1] translation overview settings page though.
Comment #62
killua99 CreditAttribution: killua99 commentedDone, added the JavaScript magic (not so magic, when you enabled for first time eg: Alt, the translation sync doesn't popup, but when you disable it, it will hide. The reason; could happen the translation sync is not even setup in the content-translation for that field)
So and I did the fix with the double $definition variable.
Comment #63
nod_This is NW from a JS point of view, will do a proper review over the weekend.
Comment #64
Gaelan CreditAttribution: Gaelan commentedIt seems that the manual testing here is done.
Comment #65
nod_seems part of the patch was included already. Light changes to the JS, It's consistent with the rest of the file so I won't touch it further.
Comment #66
killua99 CreditAttribution: killua99 commentedThis issue is getting bigger. Needs review and close the requirement for this one.
This patch sole an Notice PHP and also prevent the check for some translation_sync when is not selected yet.
Comment #67
Bojhan CreditAttribution: Bojhan commentedLooks good to me
Comment #68
YesCT CreditAttribution: YesCT commentedexcept it doesn't work all the way.
go to the content type article, manage fields, edit the image field, and click to enable the title (part of the image info).
should see the checkbox show for the title in the translation section, but it does not show.
http://screencast.com/t/DqeLj1xpql
[edit: removed comment about needing a test. since we cannot have javascript tests just yet.]
Comment #69
YesCT CreditAttribution: YesCT commented@killua99 in #58
why was this change made?
why test the sync in the OR, and why use !empty instead of isset?
Comment #70
YesCT CreditAttribution: YesCT commentedok. another problem with the previous patch was that file was missing from the translatable checkbox list. it should always show.
the change I made makes all the checkboxes show. good. now the javascript should hide based on if it's enabled or not. there is no disable on the file, so it should always be shown.
also, the javascript needs to work both on the manage field edit form, and the content language settings form.
if we need different javascript, maybe we need something different for each form?
it seems with this patch that the javascript is showing/hiding the title and alt ok on the manage field image field edit form ok. but it is hiding file, that is not ok.
and on the content/translation settings page, the javascript is not doing anything there. (not ok)
Comment #71
YesCT CreditAttribution: YesCT commentedneeds work to make the javascript work.
Comment #72
fran seva CreditAttribution: fran seva commented@YesCT this patch fix the problem with the checkbox File in content type field configuration [1].
File doesn't have an enable button so, in JS the $target variable is empty. To don't hide the file button I check it to don't apply the hide() function on the element.
[1] /admin/structure/types/manage/article/fields/node.article.field_image?destination=admin/structure/types/manage/article/fields/node.article.field_image
Comment #73
YesCT CreditAttribution: YesCT commentedComment #74
YesCT CreditAttribution: YesCT commentedWe might want to postpone work on this until #2290849: Regression: Fields missing from translation overview since "Clarify handling of field translatability" is fixed.
Comment #75
YesCT CreditAttribution: YesCT commentedAlso, definitely not novice. :)
Comment #76
YesCT CreditAttribution: YesCT commentedno need to postpone. :) we can come back to this now that #2290849: Regression: Fields missing from translation overview since "Clarify handling of field translatability" is committed.
Comment #77
fran seva CreditAttribution: fran seva commented@YesCT I'm working in this issue :)
Comment #78
fran seva CreditAttribution: fran seva commented@YesCT I've been reviewing the last patch and trying to get a general point of view of the current state of the issue. I have doubts about how should work...sorry :(.
I'm going to try to summarize (I also attach a mind map with all I have reviewed and what I've seen) but I can't promise...
There are two moments, one just after activate the content translation module (before save configuration) and other after configure and save the content translation, setting the article image field translate properties.
1. Before save configuration in admin/config/regional/content-language:
If we go to node.article.field_image
Checkboxes
- In Translatable Elements fieldset we have:
Checbox File: unchecked and visible
Checbox Alt: checked and visible
Checkbox Title: checked and hidden
- In the form we also have:
Checkbox Enable Alt field: Checked
Checkbox Enable Title field: Not checked
At this point, I have a question:
If content translation is not configure for Article content type, why is being showed in Translatable Elements fieldset?
In this form, the JS is working as expected:
If check Enalbe title field -->Translatable Elements title checkbox appears
If check Enable alt field --->Translatable Elements alt checkbox appears
If uncheck Enable title field--> Translatable Elements title checkbox is hidden
If uncheck Enable alt field --->Translatable Elements alt checkbox is hidden
In Translatable Elements, if we check File checkbox, Title and Alt are checked automatically.
Note: hidden is not unchecked, the submitted value for hidden checkboxes could be checked or unchecked.
Currently, there is just one relationship between Translate elements and enable checkboxes. That is, if we check one Enable checkbox (title or alt), the related translate checkbox appears. But, this not affect the translate checkbox value, I mean, if the enable title is checked and the Title checkbox in content translate is checked too, if we uncheck the enable title checkbox, the title checkbox will be hidden and in background will be already checked and if we submit the form, the value for this checkbox will be checked. I just wanna be sure this is the expected functionality.
What happend when the form is submitted?
If Translate Elment has Alt checked
If Translate Elment has Title checked
If Translate Elment has Alt and Title checked
In all cases the cotent translation configuration for article is updated.
At this point, I have the same question. If we don't have set the content translation configuration for Article, could we do this from this form?
2. After save configuration in content-language:
In admin/config/regional/content-language form:
Now,we have set the content translation for Article and we have the following configuration for Image field in Article
Image checkbox is checked
Image > Title checkbox is checked
Image > Alt checkbox is checked
What happen when we change the configuration (submit):
The expecte result is that node.article.field_image should be updated with the changes.
If uncheck Image > Title and image > alt ----> node.article.field_image will not show translatable elements
If uncheck Image > alt ----> alt checkbox in Translatable checkbox will be unchecked
If uncheck Image > title ----> Title checkbox in Translatable checbox will be unchecked
JS is working as expected
If Image > File checkbox is checked Title and Alt are checked and disabled
If Image > File checkbox is unchecked Title and Alt are enabled (and are still checked)
I think this is the correct functionality but I wonder if by default, in node.article.field_image, before save content-language configuration for article, the Translatable Elements shouldn't be in the form. This changes could implies check if there is set the article configuration in content-language instead get directly the default configuration.
Comment #79
jhedstromPatch no longer applies.
Comment #80
fran seva CreditAttribution: fran seva commentedThanks @jhedstrom I'm on it :)
Comment #83
rpayanmrerolled
Comment #84
fran seva CreditAttribution: fran seva commented@YesCT I'm not sure about how the translation configuration should work.
Comment #85
YesCT CreditAttribution: YesCT commentedupdated issue summary with steps to test.
I recommend we do not work on this bug until we have frontend tests.
Caution, this is not a simple issue to work on, its category of "normal" is not the difficulty, but a measure of its impact.
https://www.drupal.org/core/issue-priority
Comment #86
fran seva CreditAttribution: fran seva commentedI'm working in behat test
Comment #87
fran seva CreditAttribution: fran seva commentedComment #88
omar CreditAttribution: omar as a volunteer and commentedIn case this is useful, while working on another issue I identified some behaviours that may have contributed to the difficulties encountered with this ticket.
1) The javascript on the admin/config/regional/content-language form will check-all/un-check all the fields (except the "file" field) if/when the checkboxes for bundles are toggled... so while they load correctly to begin with, toggling may result in fields not representing their true "translatable" status (see #2492541: Toggling translatability on admin page shouldn't forget settings)
2) Saving the admin/config/regional/content-language form unexpectedly disables translation for all the (hidden) fields of the bundles for which translation is currently disabled. (see #2240139: Inconsistant behavior when enabling Content Translation) This leads to inconsistent/unexpected behaviour.
Comment #91
mparker17Reassigning as no progress for 4 months. Patch no longer applies, marking as needing re-roll.
Comment #92
mparker17Straight re-roll, so no interdiff.
Comment #93
mparker17Clarify issue summary Problem/Motivation, Proposed resolution, Remaining tasks.
Comment #94
mparker17Clarify issue summary User interface changes, API changes.
Comment #95
mparker17To clarify the accessibility tag, we need to know whether it's necessary to announce to screenreaders when these checkboxes are shown/hidden. @mgifford?
Updating the issue summary to disseminate some of the extra information to where it makes a bit more sense contextually.
Comment #96
mparker17@joelpittet pointed out #825436: Create selenium-RC PIFR plugin for full functional testing as a possible blocker in IRC. Thanks Joël!
Comment #97
mparker17Clean up / compact steps to reproduce.
Comment #98
mparker17Great, the tests pass. But there are still some things to be done (see issue summary). Back to needs work, I'll see what I can do... I've been wanting to try my hand at Behat tests for a while, so this should be good practice.
Comment #99
mparker17Adding Behat tests to https://github.com/mparker17/drupalorg_node_1920876_tests
Comment #100
mgiffordIn my manual tests the disabled fields are shown, although the text "Disabled fields are not shown. Please first enable the fields you need to make translatable." is now visible.
I just did a quick test by enabling the appropriate language modules and then going to https://dfc31.ply.st/admin/structure/types/manage/article/fields/node.ar...
Going here with the alt/title disabled still showed translation an option -
https://dfc31.ply.st/admin/config/regional/content-language
The former's more important as far as improved usability goes..
Also the image in the issue summary needs to change.
Comment #101
mgiffordComment #102
mgifford@mparker17 - "To clarify the accessibility tag, we need to know whether it's necessary to announce to screenreaders when these checkboxes are shown/hidden"
I didn't follow up on this, but yes. Certainly when the alt tag & title are enabled it would be important to announce that new material is available on the screen. It's important for discoverability.
Comment #103
mparker17Updating issue summary.
Comment #104
mgiffordIf you've got time Matt...
Comment #105
kgoel CreditAttribution: kgoel at Forum One commentedI wrote behat test for the following scenario. I used https://www.drupal.org/project/drupalextension for Drupal integration with behat. Behat Drupal Extension module doesn't seem to work with user role and drush. For this test, I gave anonymous user permissions. Documentation for setting up Behat Drupal Extension can be found - https://behat-drupal-extension.readthedocs.org/en/3.1/localinstall.html.
Go to admin/structure/types/manage/article/fields/node.article.field_image.
There is a checkbox labeled "Enable Alt field". It is checked by default.
Comment #106
kgoel CreditAttribution: kgoel as a volunteer commentedUpdated version of test using Drupal API driver for the coverage of ....
Go to admin/structure/types/manage/article/fields/node.article.field_image.
There is a checkbox labeled "Enable Alt field". It is checked by default.
Comment #107
kgoel CreditAttribution: kgoel as a volunteer commentedBehat test for testing scenario 4,5 and 6 are covered in the attached test.