Closed (fixed)
Project:
Redirect
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2019 at 19:03 UTC
Updated:
21 Jan 2025 at 22:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
thallesFollow the patch!
Comment #3
romixuaComment #4
oleksandr yushchenko commentedComment #5
oleksandr yushchenko commentedNo need to fix this issue as drupal_get_destination() used in hook_page_build() that can no longer be used.
Comment #6
thallesSo should we remove the hook?
Comment #7
romixuaYes, looks like we need to remove this hook.
Comment #8
Raman Starshykh commentedComment #9
thallesComment #10
thallesFollow the patch by removing the hook!
Comment #11
thallesComment #12
amit.drupal commentedComment #13
amit.drupal commentedAs per Drupal 8: hook_page_build() is replace with hook_page_attachments() -- see this CR: https://www.drupal.org/node/2357755
It looks like hook_page_attachments() is the right one to go with.
Comment #15
oleksandr yushchenko commentedComment #16
oleksandr yushchenko commentedRemoved unused hook_page_build() and implemented functionality with Route Subscriber
Comment #17
berdirInteresting approach, I think we need a test to make sure this functionality works and doesn't break anything.
Comment #18
oleksandr yushchenko commentedUpdated patch with tests.
Comment #20
oleksandr yushchenko commentedComment #22
oleksandr yushchenko commentedComment #23
oleksandr yushchenko commentedComment #24
oleksandr yushchenko commentedComment #25
berdirI think the problem with this approach is that it only works with the default 404 page. Most people have a custom 404 page with content I think.
Can't we use hook_menu_local_tasks_alter() for this? I've checked that this is called also if there are no local tasks yet, so we should be able to dynamically insert one.
Comment #26
oleksandr yushchenko commentedI have checked and hook_menu_local_tasks_alter() do not called if there are no local tasks yet, so lets only remove unused hook_page_build() (also redirect_is_current_page_404() which was used in hook) in this task and implement an action on 404 pages to create a redirect in new one if needed.
Comment #27
andreyks commentedAgree with #26. Hook hook_page_build does not exist in D8/9/10. So these functions can be removed. If this functionality was required, new bugs would be opened.
Comment #28
andreyks commentedReroll patch #26
Comment #29
murzI've reviewed and retested the last patch form #28 and it works well and successfully redirects on 404 pages to the configured target URL, on Drupal 8.x and 9.x too. So looks good to me and should be ready to commit!
Comment #30
berdirThe issue is about finding a suitable replacement for this feature, not just removing the code. It served a purpose, there's little to gain from just removing it.
Comment #31
berdirI changed my opinion on this, also due to #3035665: Remove hook_page_build(), it no longer exists. Doesn't look like people are that interested in it, so lets remove it.
It does need a rebase though and should be converted to a MR.
Comment #33
oleksandr yushchenko commentedCreated MR
Comment #34
berdirComment #36
berdirMerged.