Page 1 of 1

Custom functions to replace AG internal functions

Posted: 2021-03-16 14:06
by onoehring
Hi Ahmed,

this is a repost from viewtopic.php?p=16829#p16827 - but I think it has a valid place in the feature suggestions.

I just red the blog post you mentioned ( https://bigprof.com/blog/appgini/custom ... dmin-area/ ). Wouldn't it be much easier to check for custom functions first and use AG internal functions if no custom function exists?
This way the developer would be able to create his functions in e.g. /custom (or /hooks/custom) with the same filename you are using e.g. incfunctions.php. You go ahead and include these files first and the original AG files afterwards with something like this

Code: Select all

if (!function_exists('getLoggedInUser')) {
    function getLoggedInUser{
         ....
    }
}
I think this approach is for example used in the CMS Concrete5 (https://Concrete5.org) where all original files to into a different directory than custom files.

Olaf

Re: Custom functions to replace AG internal functions

Posted: 2021-04-15 22:10
by hernan
I agree, this would be a very nice feature.

Re: Custom functions to replace AG internal functions

Posted: 2021-04-22 15:20
by a.gneady
Thanks for the suggestion. I plan to move all functions into class methods in future releases. This would make it much easier to extend the classes and defined your own versions of functions you wish to overwrite.