API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
No docs on this class, though plenty of the CR here: https://www.drupal.org/node/2418529
| Comment | File | Size | Author |
|---|---|---|---|
| #85 | interdiff_80-85.txt | 461 bytes | mohrerao |
| #85 | 2994319-85.patch | 2.74 KB | mohrerao |
| #80 | interdiff_78-80.txt | 999 bytes | mohrerao |
| #80 | 2994319-80.patch | 2.78 KB | mohrerao |
| #78 | interdiff_75-78.txt | 2.17 KB | mohrerao |
Comments
Comment #2
hardikpandya commentedComment #3
hardikpandya commentedComment #4
amateescu commentedThe patch looks great! Just a small problem that needs to be fixed:
We should use the short array syntax.
Comment #5
hardikpandya commentedPlease find attached the corrected patch file
Comment #6
amateescu commentedMuch better, thanks!
Comment #7
longwave"you" or "we"? We should be consistent, I think.
Indentation in all these sample code blocks needs another look.
Comment #8
joachim commentedEach property that's unique or important for this plugin should be documented too, as seen on https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21...
The examples in the current patch (which are great!) should come after.
Comment #9
mile23Examples has an... example. :-) http://cgit.drupalcode.org/examples/tree/ajax_example/src/Form/EntityAut...
And you can learn how to test it: http://cgit.drupalcode.org/examples/tree/ajax_example/tests/src/Function...
Comment #10
benjamindamron commentedCleaned up some formatting and added some properties
Comment #11
benjamindamron commentedComment #12
mradcliffeRemember to branch / start over from 8.7.x before working on the next patch :-)
Comment #13
benjamindamron commentedDoh! Should be good now
Comment #15
izus commentedi triggered #13 retesting and it went green
so adjusting status :)
Comment #16
joachim commentedLooks good, except for this:
Long lines need wrapping.
Comment #17
longwaveBoth my comments from #7 still apply to the latest patch as well, the indentation across all code samples needs another look.
Comment #18
virajrajankar commentedComment #19
virajrajankar commentedPlease find updated interdiff patch file.
Comment #21
virajrajankar commentedUpdated interdiff
Comment #22
virajrajankar commentedUpdate interdiff and patch
Comment #24
mradcliffe@virajrajankar, it looks like you've uploaded the interdiff as the patch as well. You should create a patch of all the differences from 8.7.x as well as an interdiff which should be the changes between comment #13 and your new patch.
Comment #25
dhirendra.mishra commentedThanks for ur update @mradcliffe, Here i have fixed the issue from comment #7 and #16. Please find the patch to test.
Comment #26
mradcliffeThank you, @dhirendra.mishra. You should also change the issue status to Needs review when uploading a patch.
It is also very helpful to create an interdiff between the patch you posted in #25 and patch #13.
I reviewed the patch in #25 and I do not think this is what @joachim means with regard to "long lines need wrapping". If a new line needs to be added, then the line following it should be modified to make sense.
For instance, starting with the line added "validated". This should be indented so that it lines up with the # on the previous line. And then the following sentence "Defaults to TRUE" needs to be brought up onto the same line. This means that the entire section may need to be redone instead of only adding new lines in order to improve readability.
Comment #27
msankhala commentedHere is the updated patch which addresses comment #7 and other issues.
Comment #28
AndersNielsen commented#27 patch is looking good to me
Comment #29
joachim commentedThis is looking good, but a few problems still:
This is mostly repeating the first line.
Also, it's not a field it allows you to create. This is just a form element.
This property is not documented in the list at the top. There are a few others in the docs for processEntityAutocomplete() too. I think we can remove them from processEntityAutocomplete and put them into the class docs.
Comment #30
kalyansamanta commentedComment #31
kalyansamanta commented@joachim I have added your point 2 but I dont understand the point 1. It would be repeat mostly . Please check it and guide me if you need any changes.
Comment #32
kkalaskar commented@joachim, @kalyansamanta
I corrected point no 1. as per @joachim added. Please have a look once. I tested and Applied patch core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php cleanly on the local machine with Drupal 8.7.x.
Comment #33
kkalaskar commentedComment #34
joachim commentedThis isn't really doing what I suggested this needs in #8: document all the properties that are specific to this element, and then the examples.
The first section of a docblock must be a single line. I think the existing first line is ok!
I'm not sure why these need to be here. They're not specific to this element, are they?
These aren't in the list of properties.
Comment #38
ramya balasubramanian commentedComment #39
ramya balasubramanian commentedHi @joachim,
I have updated the patch. Please have a look and let me know if there are any issues.
Comment #40
ramya balasubramanian commentedComment #41
jungleThanks, @Ramya Balasubramanian
5 unexpected whitespaces at the end of each line
Comment #42
ramya balasubramanian commentedComment #43
ramya balasubramanian commentedThanks @jungle. Will update the patch soon.
Comment #44
ramya balasubramanian commentedHi @jungle,
I have removed whitespaces and updated the patch. Please have a look and let me know if there are any issues
Comment #45
jungleThanks, @Ramya Balasubramanian! Assigning to myself to do adjustment later
Comment #46
ramya balasubramanian commentedHey @jungle,
Could you please tell me what kind of adjustments we need to make here ?
Comment #47
jungleallowyou toallowsyouThe indention in bullets should be adjusted.
I'd change
$entityto$nodeWrapped too early.
Comment here should be moved out
@codeWell, I meant to finish it myself. Interrupted in the middle. A quick review and an incomplete patch, FYI, interdiff is ignored.
Comment #48
tdnshah commentedComment #49
ramya balasubramanian commentedSince the above patch is failed, I am assigning this ticket to myself for the changes mentioned by jungle.
Comment #50
pradeepjha commentedComment #51
ramya balasubramanian commentedHi @jungle,
I have added a patch, please have a look and let me know if there are any issues.
Comment #52
jungleLooks better, thank you again, @Ramya Balasubramanian!
can be createtocan create?I am not a native English speaker, so I'd leave this to others to do further review.
(I guess you forgot to unassign yourself, doing for you)
Comment #53
ramya balasubramanian commentedComment #54
ramya balasubramanian commentedHi @jungle,
As per your above comment, I have fixed that and added a patch. Please have a look and let me know
Comment #55
ramya balasubramanian commentedComment #56
jungleThanks, @Ramya Balasubramanian!
Wrapped too early, could be ... the element you
the same. wrapped too early.
And here, wrapped too early.
And here too, wrapped too early.
Meanwhile, I will send this to the #documentation group on slack to see if anyone could do an extra review.
So would be better to wait for feedback from others before making the new patch to save your time.
Comment #57
jhodgdonThanks for the patch! Here are some more review comments:
a) Grammar:
- Needs to start with "An" or "The".
- Before "which" you need a comma. Or better yet, change "which" to "that".
b) But actually this sentence is not factually correct. This is an entity autocomplete. It is NOT an entity reference field. They are not the same thing at all. This is an element, not a field.
c)
Please rewrite this in a style more like other documentation. Such as: TRUE if the element allows multiple entity selection; FALSE if it allows only one entity to be selected.
d)
Again, please rewrite. We don't want to see words like "should". Document what it is. This documentation doesn't tell me much -- I don't really understand it. Don't start with "It". Take a look at other documentation in Drupal core and follow that style.
e)
Don't use "indicates". These are values that the user is passing in, not return values. Better would be things like "TRUE if the referenced entity should be validated" etc.
f) There seems to be some confusion in the documentation between the "target" and "referenced" entity. Are these two different things? If so, explain what the terms mean. If not, don't use two different terms in the documentation.
g) It is not normal in API documentation like this to provide 4 usage examples. These would be better to put in a documentation page on drupal.org instead and link to it, or better yet combine into 1 usage example that illustrates the most common usage.
Comment #58
ramya balasubramanian commentedComment #59
ramya balasubramanian commentedHi @jhodgdon,
I have addressed all your comments except point no 'G'. I have checked in core and found that 'Usage Examples' were added in around 41 files like
Button.php, Checkboxes.php, Actions.php, Container.php(core/lib/Drupal/Core/Render/Element). Updated the patch and please let me know if there are any other issues. Thanks.,
Comment #60
ramya balasubramanian commentedComment #61
jhodgdonThanks! This is getting much better! Some further comments:
a)
This change is wrong. The first line of docs should start with a verb, same as the other elements and other classes. We have a standards page actually:
https://www.drupal.org/docs/develop/standards/api-documentation-and-comm...
b)
Again, what is "target"? This does not seem to tell me much. Maybe a better wording would be:
The autocomplete form element allows the user to select an entity, which can come from all or specific bundles of an entity type.
c)
Maybe it would be useful to say when it can be an array? You could change the order of the listed properties, so that #tags comes before #default_value, and it would make more sense. Also since #process_default_value is related to this property, maybe put that near #default_value too?
d)
FALSE should be all caps.
e)
This could use some rewording, -- it shouldn't start with "This #autocreate property". Also the documentation here doesn't tell me what type of value this is... is it TRUE/FALSE? A function name? I really have no idea how to use it from the documentation here.
f) No element in Core has more than 1 usage example. So please make 1 small usage example, and instead of needing 4, put more complete documentation on the properties that you are attempting to instead document through usage examples. For example:
- Each property should document its own default value.
- The selection_handler property should document what type of plugin it is (it says it is the plugin ID, but what type of plugin is it? Without that information I don't know how to find the ones available in Core or how to define my own). Also can it be left blank, or what is the default?
- The selection_settings property should document the settings available in the default selection handler, such as how to select bundles.
- The information you put in the last example should go with the autocreate property docs instead.
Comment #62
ramya balasubramanian commentedComment #63
ramya balasubramanian commentedThanks @jhodgdon, I will address your comments and will update the patch soon
Comment #64
ramya balasubramanian commentedHi @jhodgdon,
I have combined all the 4 usage examples to Single usage example and above that, I have added some brief idea about all properties of entity autocomplete. I am not very clear about the #autocreate property comment but changed the sentence now. Please have a look.
Comment #65
ramya balasubramanian commentedComment #66
jcnventuraLooks way better, thanks @Ramya Balasubramanian.
Instead of $node, can you specify
<entity object>?Also, as per #64, would be good to have in parentheses the default value of each of those properties when they aren't specified. I believe most of these can easily be found in https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
Comment #67
ramya balasubramanian commentedComment #68
ramya balasubramanian commentedHi @jcnventura,
Updated the patch now. Please have a look.
Comment #69
jhodgdonPlease make interdiff files when you upload a new patch. Thanks!
The patch is still getting better... but I feel like some of my previous review comments were not addressed... A few notes:
a)
Again, it would be good here to say explicitly when it is an object and when it is an array.
b)
I do not think we have a single other instance of "shall be" in the Drupal API documentation. Approach documentation as telling the developer trying to use this thing what they need to do. So maybe something like "Set to TRUE if the #default_value entity should be processed, and FALSE if it does not need to be processed." ... but it probably needs more explanation of what "processed" would mean? I have no idea what it means really.
c) In #66 it was asked to put default values for all properties in; I am not seeing that. Example would be something like:
d) In a previous review I asked:
please say what type of plugin this is (the name of the class or something so that someone could find it)
e) Also asked in a previous review for the selection handler options to be documented and this is not done.
f)
This is not clear, not good grammar, and I still have no idea how to use it.
g)
If we really need the "To provide" thing, it should be on the same line as Usage example: and probably should not start with a capital letter. The docs are also not matching the code, which specifies two specific bundles, not "all bundles":
Also, I noticed you said "that matches node titles" -- how do we know that will happen? Is that a property? It is not documented anywhere that matching happens on the titles.
Comment #70
ramya balasubramanian commentedComment #71
ramya balasubramanian commentedHi @jhodgon,
Thanks for your comments. Updated the patch and interdiff also.
1) I don't have idea about point no: a.
2) Then regarding
The autocomplete form element allows the user to select an entity which can come from all or specific bundles of an entity type.
Comment #72
jhodgdonThanks for the new patch! But it is quite a mess. Can you please make another pass, and make sure about grammar, punctuation, spaces around punctuation, and things like that?
And as a note, I assume the default value is an array if multiple selection is allowed, and a single entity if only 1 selection is allowed. So I would be sure to put the #tags property before #default_value so this makes sense when you explain it.
Another note: Please put the default values at the end, as we do in other documentation in Drupal, and the sentence should say "Defaults to" not "Default to".
Comment #73
ramya balasubramanian commentedHi @jhodgdon,
I have added a new patch again and nows #tags are above the #default value. And changed as 'Defaults to'. Please have a look.
Comment #74
jhodgdonI think at this point I should make a new patch rather than trying to point out all the grammar/wording issues I am seeing. I'll do that a little later today.
Comment #75
jhodgdonHere is a new patch -- making a new patch with suggested corrections was easier than trying again to explain the corrections I would suggest.
As a note, I read carefully through the code for this class and several other related classes (the plugin manager etc.) and made sure the information provided here was accurate... I think it is. Please review!
Comment #76
amateescu commented'an entity' -> 'one or multiple entities'
Because depending on the value of
#tags, multiple entities can be selected.'or array' -> 'or an array'?
#process_default_valueis missing its default value (:D) at the end of its description.#validate_referenceas well as#process_default_valueshould be placed at the bottom of the keys, below#autocreate, because they're not as important as the other ones, and they should be somehow marked as "advanced" options that should be used with a lot of care.Comment #77
longwave#76.2 IMHO, no, because it is a way of shortening "the default [...] array of entities". If we are to lengthen it it would be to "the default entity or an array of default entities".
Comment #78
mohrerao commentedAddressed comments from #76 and #77.
Comment #79
longwaveThese are incomplete sentences. "Defaults to TRUE" needs moving to the end.
Not sure we need the "Advanced option. USE WITH CARE" parts either, as it doesn't explain why it is advanced nor what care should be taken. As far as I know we don't do anything like this elsewhere in core.
Comment #80
mohrerao commentedApologies. added it in a hurry.
Removed 'Advanced option. USE WITH CARE'
Comment #81
mohrerao commentedComment #82
longwaveLooks great to me, thanks for fixing this up.
Comment #83
alexpottThe does not exist. I wonder what this is supposed to point to. I'm not sure. It was added in #73. I'm not sure linking to
\Drupal\Core\Render\Elementmakes much sense. Should we remove it?Comment #84
jhodgdonSorry, missed that in my reviews. It seems it was added in the patch in #73 and I have no idea why or what it was supposed to link to.
I think it can be removed.
Comment #85
mohrerao commentedAddressed #83
Comment #86
ramya balasubramanian commentedComment #87
jhodgdonThanks!
Comment #92
catchCommitted/pushed to 9.1.x and cherry-picked back to 8.9.x, thanks!