Can a package override the core functionality?

Permalink
Ok so there was a thread on this a while ago, but it seems to be dead. I'm developing a package where I need to significantly alter some of the core functionality of C5, but to keep it clean, I don't want to hack the core.

Specifically, I need to override some of the default models/ and libraries/. Anyone have any experience or success in doing so?

focus43
View Replies:
Fernandos replied on at Permalink Reply
Fernandos
Hi JonoHartman!

Ehrm.. that's what those empty folder are for outside of the concrete/ folder..

And yes c5 you can replace single_pages etc. via packages, but that's limited. So if you want to hack around. Those empty folder are where you start. Create a copy of the core file and drop it into the empty dir then start hacking around. C5 will pick your file first instead of the core file.
focus43 replied on at Permalink Reply
focus43
Hi fernandos,
Appreciate the quick response.

I'm actually pretty well tenured in working with C5, so I'm aware of how the directory structure works and the process of overriding core files. But, the package I'm developing needs to extend/modify - more or less - all of the functionality for handling files in C5. (I'm trying to extend C5 to store files on Amazon S3).

I thought that the dispatcher actually checked packages before the mirrored parent directory for files to override, but it doesn't seem to work for me.

If you've done it from a package, what'd you do?
Fernandos replied on at Permalink Reply
Fernandos
That depends on what you want to do..that's a too general question, so I can't answer it, sorry.

As said. Packages are meant to extend c5 with Addons, that's why they can't replace everything inside /concrete, but some of its functionality.

Example package directory:
/packages/mypackage/
models/
single_pages/
controllers/
elements/
libraries/

that's all possible in Packages too.
focus43 replied on at Permalink Reply
focus43
Fair enough.

Specifically I need to override the File and FileVersion core models. Thats really it.

Thanks.
Fernandos replied on at Permalink Reply
Fernandos
I'm not sure, but I think that should work for file and fileversion.

just create a models dir in your package then place your modified file into that dir.
If you want to use it internally from within the package you need to tell c5 where it is like: Loader::model('file','my_package');