Updated: Comment #13
Problem/Motivation
To provide a better interface, field handler methods should typehint the result row values (Drupal\views\ResultRow).
Proposed resolution
Typehinting params of field handler methods using Drupal\views\ResultRow and adjust docblocks appropriately:
- render()
- advancedRender()
- renderLink()
- getValue()
- theme()
Remaining tasks
None.
User interface changes
None.
API changes
None.
Related Issues
Original report by @damiankloip
After #2034947: [Change notice] Change view results to use a classed object is in, we can typehint all the places this is used. Field handler methods render, advancedRender, render_link, getValue, maybe more...
Comment | File | Size | Author |
---|---|---|---|
#11 | 2034979-11-views_resultrow_typehint.patch | 27 KB | derhasi |
#11 | interdiff.txt | 1.19 KB | derhasi |
#8 | 2034979-8-views_resultrow_typehint.patch | 27 KB | derhasi |
#8 | interdiff.txt | 19.55 KB | derhasi |
#4 | 2034979-4-views_resultrow_typehint.patch | 25.6 KB | derhasi |
Comments
Comment #1
damiankloip CreditAttribution: damiankloip commentedGood to go
Comment #2
Crell CreditAttribution: Crell commentedThis needs more precise directions for a novice issue. (Hello from Drupal Camp Costa Rica! Pura Vida!)
Comment #3
derhasi CreditAttribution: derhasi commentedApplied summary template and now going to work on it.
Comment #4
derhasi CreditAttribution: derhasi commentedAttached is the patch for typehinting ResultRow in all views field plugins. It's quite a big patch, as there where a lot of docblocks not properly provided.
Comment #5
derhasi CreditAttribution: derhasi commentedComment #5.0
derhasi CreditAttribution: derhasi commentedApplying summary template
Comment #6
dawehnerWow this was a big patch. Thank you for working on that!!
It would maybe make sense to typehint CommentInterface on the common base class (the link handler for comments) so you get better autocompletion in this single function but yeah this is maybe out of scope.
Let's use the full namespace here as well.
Comment #7
damiankloip CreditAttribution: damiankloip commented'Returns a string for the link text'
Can this be more general?
Just the values from a row of view results or something? (I have nothing that good right now! :))
Otherwise, generally looking pretty good.
Comment #8
derhasi CreditAttribution: derhasi commented@dawehner, yes, should make sense, but I think it is out of scope for this issue.
dawehner, damiankloip: I implemented your proposed changes (see interdiff.txt).
Comment #9
dawehnerGood work!
Comment #10
damiankloip CreditAttribution: damiankloip commentedExtra line.
No variable name.
Sorry.. :/
*hides*
Comment #11
derhasi CreditAttribution: derhasi commented@damiankloip, thanks, nothing to hide ;) You are totally right, so here's the fix.
Comment #12
derhasi CreditAttribution: derhasi commentedComment #13
damiankloip CreditAttribution: damiankloip commentedGreat, thank you!
Comment #13.0
damiankloip CreditAttribution: damiankloip commentedUpdating method names found. Remaining task added to decide on docblock change.
Comment #14
catchCommitted/pushed to 8.x, thanks!
Comment #15.0
(not verified) CreditAttribution: commentedUpdated "Remaining tasks"