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.
Currently core provides no way of overridding the page generated by the function tracker_page() in tracker.pages.inc. So if a user wants to say override the number of pages shown in the pager (which I am), there isn't an easy way to do this.
I'm attaching a patch to the first post that will add the following code to the end of the tracker_page() function:
$page['#account'] = $account;
drupal_alter('tracker_page', $page);
Comment | File | Size | Author |
---|---|---|---|
#1 | d8core-add_drupal_alter_to_tracker_page-2211795-1.patch | 405 bytes | Jaypan |
Comments
Comment #1
Jaypan CreditAttribution: Jaypan commentedAttaching patch
Comment #2
dawehnerThere is a different issues which tries to convert this page to a view. Would this solve your feature request as well?
Comment #3
Jaypan CreditAttribution: Jaypan commentedProbably not, as Views uses a views pager. So if this issue is not going to move forward because of that, then lets change it to D7, which won't be converted to a view.
Comment #4
Jaypan CreditAttribution: Jaypan commentedComment #5
dawehnerI don't get this point. Can't you change pretty much anything with it?
Comment #6
Jaypan CreditAttribution: Jaypan commentedYes, but this patch is based on the existing method of building the tracker page.
Comment #7
Jaypan CreditAttribution: Jaypan commentedSorry, I just realized I've been mixing up two related issues I'm posting in.
Ignore my comments about the pager, that is my overall goal, but not related to this current issue. This current issue is to allow overriding of the tracker page, something that cannot be done. If the tracker page is switched to a view, then the function tracker_page() would be removed, because the page would be created in views, and the method of overriding it would be completely different. That's why this thread should be changed to D7, as Views will not be used to create the tracker page in D7.
Comment #8
dawehnerWell, in Drupal7 you can use hook_page_alter directlly.
Comment #9
Jaypan CreditAttribution: Jaypan commentedYes and no. First, hook_page_alter() is way too broad. It gets called on every page load, implementing it to make changes on a single page on the system, and adding a check to see if it's the tracker page on every page load adds unnecessary overhead.
Second, the tracker page doesn't embed the pager in any sub element of the array, so there is no way to specifically alter only the pager on the tracker page.
And from a precedent perspective, Drupal offers hook_form_FORM_ID_alter() as well as hook_form_alter(), and hook_block_view_MODULE_DELTA_alter() as well as hook_block_view_alter(), allowing for hooks that target specific forms and blocks, as well as the blocks overall. This alteration would allow for altering just the tracker page, or altering all pages (hook_page_alter()).
Comment #10
marvil07 CreditAttribution: marvil07 commentedLinking related ticket about converting it to a view, if that gets in I think it's safe to close this or move it to D7 only.
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedClosing as duplicate of https://www.drupal.org/project/drupal/issues/1941830 which I'm trying to put effort in as we speak.
Feel free to reopen for D7 if you wish though.