How to Override Core Class?
Permalink
Anyone know how to override a core class/method in 5.7? I posted the following a while ago...
http://www.concrete5.org/community/forums/5-7-discussion/custom-cla...
At that time, I just wanted to create my own custom class by extending a core class, and that turned out to be relatively straightforward. Now, though, I want to simply override a core class so that the rest of the core uses my implementation, and it's unclear how to proceed. I must be missing something.
Can anyone help?
Thanks,
-Steve
http://www.concrete5.org/community/forums/5-7-discussion/custom-cla...
At that time, I just wanted to create my own custom class by extending a core class, and that turned out to be relatively straightforward. Now, though, I want to simply override a core class so that the rest of the core uses my implementation, and it's unclear how to proceed. I must be missing something.
Can anyone help?
Thanks,
-Steve
> rest of the core uses my implementation, and it's unclear how
> to proceed.
One possibility is, what if array_merge() was used to merge the core alias list with an application alias list before passing it to registerMultiple() here...
https://github.com/concrete5/concrete5-5.7.0/blob/master/web/concret...
That way, the auto loader would use the developer-defined alias, and overriding a core class would be a simple matter of making an entry in an application config file (alias array) and then implementing the class in a file that resides in the application directory.
I tried registering an alias from app.php, but that's too late in the start-up process.
Thoughts?
-Steve