3: Initialization, constants, and the NV class
NV class performs all the theme framework’s initialization/bootstrapping; it loads all the classes, other framework files, theme hooks, and components. It is located in
When starting a new project, this is usually the first file you should look at. This article will deal almost exclusively with this file.
By using a singleton pattern for the
NV class we can ensure that hooks are never accidentally executed more than once. This pattern also allows us to drop sloppy global theme constants in favor of nice, scope-appropriate class properties. Although the class is initialized automatically, you can access the singleton instance at any time by calling
Step 1: Set Properties
The first thing the class does is load all necessary theme properties. In NOUVEAU, you have two primary property objects:
This object includes a list of system paths for all of NOUVEAUs main includable files and directories.
This object includes a list of URLs for all of NOUVEAUs main URL-accessable files and directories.
For a full list of properties, see
Step 2: Load Language
If available and configured, language files are loaded by
Step 3: Execute Hooks
Finally, all the hooks needed to set up the theme are executed by
NV::hooks(). You should place your own hooks in this method… but before you add new hooks, have a quick look here to see if the hook you want to use is already configured.
If you are just getting started with NOUVEAU, you should be able to learn just about everything you need to know by taking a look at the
NV::hooks() method. It’s fully commented and organized for quick and easy reading.
This page was last updated on September 15, 2016 – it is currently considered BEING REVISED.