How to do this in Phoenix?

Talk about Hooks. Share Hooks you have made.
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: How to do this in Phoenix?

Post by raiwa »

Mort_Lemur wrote: Fri Jun 12, 2026 4:21 pm
raiwa wrote: Fri Jun 12, 2026 1:06 pm Example of a sitewide hook for your case:
placed and named:
includes/hooks/admin/siteWide/redirectInvoice.php

Code: Select all

class hook_admin_siteWide_redirectInvoice {

  function listen_siteWideStart() {
    if (Request::get_page() == 'invoice.php') {
      Href::redirect(Guarantor::ensure_global('Admin')->link('invoice_ara.php')->retain_query_except());
    }
  }

}
Thanks for that hook code, however when i rename my invoice invoice_fancy.php and edit the hook code to match it seems to only render the top half of the invoice to just below the address boxes?

Yet when the file is named invoice.php and the hook is deleted, the whole invoice shows.
Nothing to do with the hook. Your invoice code probably has an error. Check your error log or switch display errors on.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
Mort_Lemur
Builder
Posts: 63
Joined: Tue Jun 02, 2026 6:12 pm
Phoenix Version: v1.1.0.6
Has thanked: 42 times
Been thanked: 17 times

Re: How to do this in Phoenix?

Post by Mort_Lemur »

as @bonbec advised replicating the language file invoice.php as invoice_fancy.php solved the problem :)
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: How to do this in Phoenix?

Post by burt »

Sometimes `not changing core code` appears impossible, so if you do find a bottleneck somewhere...let us know.

We will then change core to solve the bottleneck if needed.
Or point you down the right path to do what you need without core changes. (eg, as per this thread)


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply