Problem/Motivation
\Drupal\Core\Render\Element\LanguageSelect
is a form element that - without rendering an actual form element - always returns the value of the default language. It is then extended by Language module via language_element_info_alter()
to provide a proper language selector.
This is done so that modules can provide language integration without having to depend on Language module or introducing a $module_handler->moduleExists('language')
check and Language module doesn't have to introduce knowledge about any particular module. In short: It's a good thing! :-)
However, when just looking at the LanguageSelect
class this is not very obvious, because there is no documentation about this fact. The @see
to \Drupal\Core\Render\Element\Select
doesn't help either (and arguably makes things more confusing).
Proposed resolution
1. Add documentation to the class about the above.
2. Add a @see
to language_element_info_alter()
3. Optionally consider moving the @see
to \Drupal\Core\Render\Element\Select
over to language_element_info_alter()
.
Remaining tasks
Write patch! :-)
User interface changes
None.
API changes
None.
Beta phase evaluation
Issue category | Task because the added documentation improves DX but nothing is broken/incorrect about the current docs (it's just lacking). |
---|---|
Issue priority | Normal |
Unfrozen changes | Unfrozen because it only changes documentation |
Comments
Comment #1
tstoecklerComment #2
arskiainen CreditAttribution: arskiainen as a volunteer commentedIf I understood the issue correctly, this should provide resolution.
Comment #3
arskiainen CreditAttribution: arskiainen as a volunteer commentedComment #4
tstoecklerAwesome, thanks @Arskiainen. This is exactly what I meant.
Unfortunately, I cannot mark the patch RTBC (yet!) because our documentation standards require each class documentation to start with a one-line summary. So I think it would be preferred to leave the existing one-line summary and change the sentence you added so that it makes sense in the combination (sorry if I'm not making sense, this is hard to explain with words).
Or if you find some other way to convey the information, absolutely feel free to go crazy :-P. It just needs to start with a one-line summary.
Comment #5
arskiainen CreditAttribution: arskiainen as a volunteer commentedIs this what you meant?
Comment #7
tstoecklerYes, except that now both sentences start with
which sounds a bit strange in my opinion. So I think we need to rephrase this somehow.
(Sorry for being so pedantic :-/)
Comment #8
arskiainen CreditAttribution: arskiainen as a volunteer commentedHow about now?
Comment #9
arskiainen CreditAttribution: arskiainen as a volunteer commentedComment #11
tstoecklerYes, that sounds very good!
I found two more super minor things, sorry. I promise I'll RTBC the next patch :-)
1. The sentence is now actually missing a subject, so I would suggest to add a "This" in the beginning of the sentence.
2. We are not allowed to use contractions in Drupal core, so "Doesn't" should be "does not". Sorry for just pointing this out now, I should have seen this earlier.
So in summary:
"Doesn't" -> "This does not"
But make sure to break the line at 80 characters.
Thanks for sticking with this, much appreciated!
Comment #12
jaimeguzman CreditAttribution: jaimeguzman as a volunteer commentedHI how about this.
Comment #13
tstoecklerYay, thanks @jaimeguzman. Nothing to complain anymore. :-)
@jaimeguzman this issue was still assigned to @Arskiainen which probably means @Arskiainen wanted to finish this issue. That's why it's best to check the "Assigned" field before working on an issue and if you start working on something assign the issue to yourself.
Nevertheless, RTBC.
Comment #14
jaimeguzman CreditAttribution: jaimeguzman as a volunteer commentedthanks @tstoeckler , was my first patch for help =). I'll check the next time. assigned field.
My apologies @Arskiainen
Comment #15
tstoecklerOh no, I found something else. I was without Dreditor earlier, so I missed it:
There is a trailing whitespace after the "returns" that should be removed. Also, I think the line is breaking to early. the "the value of" should still fit into the next line.
@Arskiainen maybe you can finish this one, then?
Comment #16
arskiainen CreditAttribution: arskiainen as a volunteer commentedA little clean up.
Comment #18
arskiainen CreditAttribution: arskiainen as a volunteer commented...
Comment #19
tstoecklerYay, thanks @Arskiainen!
Let's get this in.
docs++
confusion--
Comment #20
jaimeguzman CreditAttribution: jaimeguzman as a volunteer commentedGreat @Arskiainen
Cheers guys !
Comment #23
tstoecklerComment #24
alexpottDocumentation improvements are permitted during beta. Committed ac8605b and pushed to 8.0.x. Thanks!
Comment #27
Gábor HojtsySuperb, thanks!