What about core directory?

Permalink 1 user found helpful
I want to know about the core directory functionality. could anyone explain about the core directory...

Thanks in advance...

cjramki
 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Core is used for core functionality and should never be modified.

It is nearly always accessed though wrapper classes. For example
class xxx_controller extends core_xxx_controller{
}


This enables you to override a core class by extending it rather than having to replace all of it (like you used to have to do in older versions of c5).

You still need to make the overrides in your root level directories, or in a package by calling overrideCoreByPackag(). But rather than copying an entire core class to modify just a few lines, you can simply extend the core class and just declare the methods you are changing.
Ligerat replied on at Permalink Reply
and where i have to call the overrideCoreByPackage()
JohntheFish replied on at Permalink Reply
JohntheFish
Usually in a package controller on_start event handler method.

You can also call it from other places you can have an on_start handler.

It needs to be early on in the overall scheme of things so the override can be established before concrete5 has loaded the original class.