In TranslatorForm there are two form elements with a bit similar names: Translator settings and Plugin settings.
To be able to run user interface tests (web tests) properly and to improve code readability we should rename Translator settings form element ID to something else which should distinguish the difference between these two settings. In that case, we can leave plugin settings form element as it is.
Also, we should remove the check @miro_dietiker mentioned in #2.
NOTE: This issue is reserved for one of the possible new students in MD Systems! Do not start to work on this except you are the student we sent this issue to. :)
Comments
Comment #2
miro_dietikerAlso terminology is unclean here. Twice settings in one form is odd.
From looking at the code:
The last check with unset never happens because of the auto_accept situation.
I think we should simply drop the settings term in the TranslatorForm level and only use that term for the plugin.
Raising prio since we are changing the form structure with this issue.
Comment #3
mbovan commentedUpdating the issue summary to be more clear.
Comment #4
tduong commentedUploaded patch for issue #2569343.
Comment #6
tduong commentedPreviously uploaded empty patch file: re-uploading patch for issue #2569343.
Comment #9
miro_dietikerWe still have two items with XYZ Settings title as a result.
I would still drop "Translator settings" completely around the auto accept checkbox. Everything on this form is kindof a setting.
And only introduce a plugin specific settings wrapper / title.
Comment #10
berdirThe problem with auto_accept and the settings element there is that we do currently store auto_accept within settings in the translator.
I agree that we should try to get rid of the translator settings wrapper completely, we should never have had two of them. That happened somehow during the conversion to plugins I guess.
However, to do that, this gets a bit more complicated. We need to change a number of places where we define/access auto_accept:
* The schema
* It needs to become a property in the Translator class, with methods in TranslatorInterface and Translator to access it (isAutoAccept()?)
* Search for uses of getSetting('auto_accept') and replace it with the new method.
Comment #11
tduong commentedSorry, I have misunderstood the task, my bad.
I have already asked to @mbovan, but to be sure I post here my draft-solution and doubts.
I have added:
I'm still not clear about these 2 sentences:
Comment #14
tduong commentedUpdated patch:
I'm still not sure what @miro_dietiker means.
Comment #16
berdirNice, this looks pretty good to me. Also tested the UI, looks a lot better now.
Miro basically said the same as I did, just not as specific. So you have his feedback covered with that patch.
Just some minor coding standard and documentation issues left, assuming the patch will pass:
for @var and @type types, it's just bool, not boolean (Also just int and not integer).
Needs the @inheritdoc blocks just like on the methods around those two.
Copied from setSetting() I guess, should be more specific.
I guess this is copied from setSetting(), you can do just return $this, no description needed. (Don't change existing places, just make sure yours is correct).
Comment #17
berdirAh, I think what you are missing is adding that property to the config_export list in the Translator annotation.
Comment #18
miro_dietikerYeah nice, just some extra nitpicking:
One you change an existing label to add the quotes, and your own new label still lacks quotes. Consistency. :-)
Comment #20
tduong commentedUpdated patch:
Comment #21
berdirWe no longer need auto_accept in here as we moved it away. This will result in an empty mapping, which is fine.
while touching this, the type here is wrong, should be type: mapping, so the results looks like this:
When doing iterative changes on a page, always provide an interdiff: https://www.drupal.org/documentation/git/interdiff. Then we don't have to read the full page again to check your changes.
Comment #22
tduong commentedUpdated file interdiff:
Thank you, I was wondering whether this has to be removed or not.
Comment #25
mbovan commentedThe patch looks good.
However, several tests are failing on schema errors.
I suppose that we need to update
TranslatorPluginBase::defaultSettings()and remove the auto_accept from there as it is not part of the settings any more.Also, you can check if tests are passing locally before uploading the patch. All you need to do is to enable Testing module from Extend tab in Drupal administration. Then, you can access Testing module by clicking on Configuration > Testing. From there, you can run all TMGMT tests by checking that option or you can run specific test you need.
Happy testing! :)
Comment #26
tduong commentedUpdated file interdiff:
Thanks for the advice! :)
Comment #27
miro_dietikerYay, fixed some core change separately and committed the patch.
Looks much cleaner now!