Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
tracker.module
Priority:
Critical
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
17 Apr 2013 at 17:05 UTC
Updated:
29 Jul 2014 at 22:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #0.0
Jberges commentedAdded parent issue
Comment #0.1
Jberges commentedAdded instructions link in correct format
Comment #1
Jberges commentedFirst patch.
tracker_page() cannot be removed from tracker.pages.inc because is used in other callbacks. I will be working on those other callbacks, but first I want to check if this patch is OK.
Comment #2
Jberges commentedComment #3
valthebaldJust a minor remark before your submit the next patch: TrackerController.php contains extra space in the end. Otherwise, patch looks great.
Comment #4
ParisLiakos commentedthanks for picking this up:)
No need to have a comment there, just {inheritdoc}
lets get rid of db_select and entity_load_multiple
To do so we need to inject the database and plugin manager service and store them to $this->database and $this->entityManager
you can check the patch here #1963410-19: Convert aggregator_form_opml to a FormInterface implementation and routing definition to get an idea from a similara conversion:)
Comment #5
Dean Reilly commentedAddressing the issues raised in #4.
Comment #7
dawehnerThanks for converting the tracker page, but you could also remove the old code :)
... That's for tracker :)
There shouldn't be a ";" at the end.
Let's name is database connection object.
Let's use a follow up to use a build array here.
No need for the file anymore.
Comment #8
dokumori commentedMade most of the changes suggested by @dawehner as well as some other minor changes. (The fourth suggestion re array has not been implemented.)
This still doesn't pass the tests - some issues in a select query of trackerPage in TrackerController.php
Comment #9
dawehnerFixed the code, so that the test passes now.
Comment #10
ParisLiakos commentedneeds new line and docblock some indentation
indentation too
should not be there
is tracker_page() still needed? i dotn see it removed
Comment #11
dawehnerOh you are totally right.
I fixed also some other small points.
Comment #13
Dean Reilly commentedThe other menu items also use the tracker_page() function. Here's a patch which starts on converting them but still needs some work doing. Specifically:
I'm still getting up to speed with the WSCCI stuff so any help around this would be great.
Comment #14
Dean Reilly commentedAhh, looking at the interdiff, I see what caused point 3. Fixed in this patch.
Comment #16
mradcliffeIssue needs a summary from comment #13, and a re-roll.
Comment #17
dawehnerMaybe someone else has a better idea for the access checker
As you need to get on the code anyway: Let's better use {@inheritdoc}
It should use an injected entity Manager to load the user.
I guess the reason why it doesn't work is that you don't have the same name: account vs. user.
I really like that we can reuse the same controller all the time.
There should be no newline.
Comment #18
dbcollies commentedComment #19
dbcollies commentedComment #20
pwolanin commentedI'll try this one
Comment #21
pwolanin commentedThis makes some improvements, but there is a fatal error on /tracker due to the removal of _to_arg functions. I think this should be considered blocked on #2004334: Separate Tabs (MENU_LOCAL_TASK) from hook_menu()
Comment #22
pwolanin commentedComment #23
dawehnerThe coding standard tells about using {@inheritdoc} instead + in the other files.
Nitpicking: There is an empty line needed after the pre-last "}"
Contains "\"
This should get also the actual entity manager injected unless we want magic to happen.
Seems to be a temporary fix :)
I guess we should have the same cardinality (users vs. user)
Comment #24
pwolanin commentedtracker_user_tab shoudl be singular I think - the s in the other is indicating possessive 's I think?
Adds back the missing entity controller.
Comment #26
star-szrThis no longer applies, will need a reroll to move things further.
Comment #27
dawehnerDon't we actually want to be these pages to be a view?
Comment #28
pwolanin commented@dhwehner - would make sense to be to be a View - however, I'm not sure Views has even been able to handle the kind of "to_arg" functionality in question?
Comment #29
pwolanin commentedComment #30
dawehnerOkay as far as I understand to_arg is basically what we now call parameter conversion/upcasting so convert an ID to an actual object.
Why would views need this? If something is filtered then it is always filtered by ID. For the page title it just calls user_load and then use the label.
Comment #31
ajitsPatch at #24 re-rolled for testing.
Thank you heddn for mentoring me on this.
Comment #33
xjmThanks for your work on this issue! Please see #1971384-43: [META] Convert page callbacks to controllers for an update on the routing system conversion process.
Comment #34
jibranold patch needs massive reroll.
Comment #35
disasm commentedDon't bother rerolling per #27. If someone wants to work on this, start from scratch writing a view.
Comment #36
pwolanin commentedLet me try implementing now that we have all the routes in.
Comment #37
pwolanin commentedworking on this today - making a class per route as we discussed earlier in the week.
Comment #38
pwolanin commentedPrior patch didn't apply, so here's a new version with quick conversion of the controllers.
Comment #40
pwolanin commentedforgot a couple use statements in the local task class.
Comment #41
pwolanin commentedfix tags
Comment #42
pwolanin commentedopps, we should just delete tracker_menu()
Comment #43
dawehnerLet's better implement StaticAccessCheckInterface
Let's also use @inheritdoc
We could use some documentation here at there.
Let's use tracker.page_tab for now as we do convert all the other instances anyway.
Comment #44
pwolanin commentedok, made those changes.
Comment #45
tim.plunkettThese are backwards, I'm pretty sure we'll be passing in AccountInterface $account eventually, and 'user' is UserInterface... just swap the variable names
Weird indent
I don't see a reason to not combine these for now... doesn't matter though
Comment #46
pwolanin commentedI was trying to start aligning with the class-per-page approach (obviously does not matter much for this path).
Comment #47
dawehnerBeside from this this is looking pretty good.
Is there a reason we don't add the 'access content' bits to the route definition and choose the 'ALL' access mode?
Comment #48
pwolanin commentedok, moved the permission check back to the route. Also, we should check that the $user is not empty, since case we get a Request where it's not present.
Comment #49
dawehnerThis looks good so far.
Comment #50
webchickSince this is the only functional piece of code here, I'm mystified why we need...
...all of these lines of code to do it.
Do we need a LocalTaskDefaultBase? create() should basically never appear in "user-space" code unless they're doing something very out of the ordinary.
Comment #51
tim.plunkettWe have a LocalTaskDefault. Unfortunately when you override the parent's create(), you have to pass all of the same stuff through.
The only added parts here are
$this->currentUserId = $current_user_id;and$container->get('current_user')->id()But, we can simplify the need for that by making the parent class use a local getter for the route provider (a la FormBase/ControllerBase). This is even better since the main reason to override this class is to take over getRouteParameters, which is the only method that uses the route provider.
The $configuration, $plugin_id, $plugin_definition stuff is not avoidable right now.
Comment #52
pwolanin commentedThat looks like a move in the right diretion, but we discussed in IRC adding a currentUser() method to the default local task and a @todo to add it to the base plugin class. That way we wouldn't need any constructor injection (which webchick apparently hates).
Oh course, I'm fine this way too.
Comment #53
pwolanin commentedLike this makes it much simpler.
Comment #54
pwolanin commentedrelated patch: #2105123: Add a currentUser() method to plugin base classes that need it
Comment #55
pwolanin commentedSilly me - that method doesn't need to be public
Comment #56
dawehnerThere is no reason for the additional access checker, as this is just entity access.
Comment #57
pwolanin commentedI don't think the interdiff is complete.
Comment #58
dawehnerOh well, the interdiff is missing the removed file.
Comment #59
tim.plunkettThanks!
Comment #60
webchickOther than the fact that this patch sorely identifies how badly we need to clean up the DX around access checkers, this looks good to me.
Committed and pushed to 8.x. Thanks!
Comment #61.0
(not verified) commentedRemoving link