SS_TemplateManifest
class SS_TemplateManifest
A class which builds a manifest of all templates present in a directory, in both modules and themes.
Constants
TEMPLATES_DIR |
|
Methods
Constructs a new template manifest. The manifest is not actually built or loaded from cache until needed.
No description
Generate a unique cache key to avoid manifest cache collisions.
Returns a map of all template information. The map is in the following format:
Returns a set of possible candidate templates that match a certain template name.
Returns the correct candidate template. In order of importance, application project code, current theme and finally modules.
Regenerates the manifest by scanning the base path.
No description
Details
at line 31
__construct(string $base, string $project, bool $includeTests = false, bool $forceRegen = false)
Constructs a new template manifest. The manifest is not actually built or loaded from cache until needed.
at line 50
string
getBase()
at line 61
string
getCacheKey(boolean $includeTests = false)
Generate a unique cache key to avoid manifest cache collisions.
We compartmentalise based on the base path, the given project, and whether or not we intend to include tests.
at line 96
array
getTemplates()
Returns a map of all template information. The map is in the following format:
array(
'moduletemplate' => array(
'main' => '/path/to/module/templates/Main.ss'
),
'include' => array(
'include' => '/path/to/module/templates/Includes/Include.ss'
),
'page' => array(
'themes' => array(
'simple' => array(
'main' => '/path/to/theme/Page.ss'
'Layout' => '/path/to/theme/Layout/Page.ss'
)
)
)
)
at line 114
array
getTemplate(string $name)
Returns a set of possible candidate templates that match a certain template name.
This is the same as extracting an individual array element from {@link SS_TemplateManifest::getTemplates()}.
at line 137
array
getCandidateTemplate(string $name, string $theme = null)
Returns the correct candidate template. In order of importance, application project code, current theme and finally modules.
at line 163
regenerate(bool $cache = true)
Regenerates the manifest by scanning the base path.