You may have noticed that the root directory of a fresh concrete5 installation contains a number of folders, most of which are empty-- only the config/, files/ and concrete/ directories contain anything. You may have also noticed that much of this structure is repeated inside the concrete/ folder, this time including many files. This structure is used to determine which files included in its core, and versions that have been altered or customized. We call altered code kept away from the core directory-- and placed in the site-root-level folders instead-- an override.
When a helper, for instance, is called upon to load jQuery, it first checks the override directory for a file named jquery.js:
If nothing is found there, it defaults back to the default location for jQuery, inside the concrete/ directory:
and inserts a reference to that one into the page. There’s no alteration of code required to get concrete to load the new one; if the file is present in the overrides directory, it will be loaded in place of the original. The same applies to almost any directory below concrete: blocks, models, elements, etc. Anything in these core directories can be overridden simply by copying it up to the corresponding override directory in the site root.
Why should I use an override?
The advantages of following this system will become very much apparent as you customize and extend concrete5 to meet the needs of your projects. First, it provides a safe means of repairing or upgrading a broken site: one can swap the entire core directory out and replace it with a fresh copy, without worrying about losing a customization placed somewhere deep inside the concrete/ directory.
If you’re still in the process of developing and refining your override, an original copy of the file you’re working with can always be found in its original location beneath the concrete/ directory in case you need to revery or compare. If an override has become problematic for any reason ( (for instance, it needs to be updated to work with an updated concrete5 core), it can easily be located and fixed.