Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #6
Problem/Motivation
In ViewExecutable
several methods dealing with Views handlers are using ...Item()
instead. Especially as ViewExecutable::getItemsPerPage()
and ViewExecutable::setItemsPerPage()
are used in a total different context this may be very confusing.
Proposed resolution
Renaming the following methods to use "Handler" instead of "Item":
- addItem() => addHandler()
- generateItemId() => generateHandlerId()
- getItems() => getHandlers()
- getItem() => getHandler()
- removeItem() => removeHandler()
- setItemOption() => setHandlerOption()
Remaining tasks
-
User interface changes
-
API changes
Public methods of \Drupal\views\ViewExecutable
are renamed:
- addItem() => addHandler()
- generateItemId() => generateHandlerId()
- getItems() => getHandlers()
- getItem() => getHandler()
- removeItem() => removeHandler()
- setItemOption() => setHandlerOption()
Developers dealing with handlers associated to a view need to rename their method calls.
The AddItem form is now called AddHandler.
Comment | File | Size | Author |
---|---|---|---|
#24 | interdiff.txt | 862 bytes | dawehner |
#24 | vdc-2143495.patch | 68.11 KB | dawehner |
#20 | vdc-2143495.patch | 67.73 KB | dawehner |
#18 | interdiff.txt | 1.82 KB | dawehner |
#18 | vdc-2143495.patch | 68.52 KB | dawehner |
Comments
Comment #1
derhasi CreditAttribution: derhasi commentedComment #2
derhasi CreditAttribution: derhasi commentedComment #3
derhasi CreditAttribution: derhasi commentedThere's the patch ^^.
There are two things I very much would get feedback for:
\Drupal\views_ui\Form\Ajax\AddItem
really only deals with handlers.Comment #4
dawehnerI do prefer using getHandler() over getHandlerInstance().
Comment #5
dawehnerOH and yes, I am fine with renaming the AddItem form as well!
Comment #6
derhasi CreditAttribution: derhasi commentedThere's the update with the Form changed and hopefully all references in description updated.
Comment #8
dawehner6: viewexecutable-naming-item-to-handler-2143495-6.patch queued for re-testing.
Comment #10
dawehnerContinued with doing the work on that and potentially fixed the test failure.
Comment #11
tim.plunkett+1 for the naming change.
I'll be back for a full review when it passes.
Comment #12
damiankloip CreditAttribution: damiankloip commentedI think this is pretty good already. Nice work.
Comment #13
star-szrTagging for reroll.
Comment #14
dawehnerHere is one.
Comment #16
dawehnerOH i missed the move in the last reroll.
Comment #18
dawehnerLet's fix the last one.
Comment #19
damiankloip CreditAttribution: damiankloip commentedIf we're changing these paths anyway, do you think it's worth us improving them slightly? Getting rid of the 'config-' part for starters maybe.
Comment #20
dawehnerI would like to get the patch as straightforward as possible though I agree about the paths.
Damnit I hate that we don't use routes on there already. this would make things trivial.
Comment #22
dawehner20: vdc-2143495.patch queued for re-testing.
Comment #24
dawehnerComment #25
tim.plunkettComment #26
dawehner24: vdc-2143495.patch queued for re-testing.
Comment #27
dawehnerGiven how much this really make it easier to understand what getItem() is for.
Comment #28
dawehner24: vdc-2143495.patch queued for re-testing.
Comment #29
damiankloip CreditAttribution: damiankloip commentedAgreed, it really does. It's a big benefit for such a simple change.
Comment #30
derhasi CreditAttribution: derhasi commentedThanks for re-re-re-re-re-rolling. Great work!
Comment #31
webchick"Item" is a generic-enough word that agreed it doesn't make much sense to use it when there's another, more descriptive noun available. Especially if we're using "Item" elsewhere to mean something totally different.
Committed and pushed to 8.x. Thanks!
This'll need a change notice.
Comment #32
Les LimUnassigning for the change notice writeup.
Comment #33
lexfunk CreditAttribution: lexfunk commentedAssigning to myself for change notice writeup.
Comment #34
lexfunk CreditAttribution: lexfunk commentedI created the change record: https://drupal.org/node/2181701.
Comment #35
dawehnerNice!