SS_TemplateManifest
class SS_TemplateManifest (View source)
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
__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.
string
getBase()
string
getCacheKey(bool $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.
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'
)
)
)
)
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()}.
array
getCandidateTemplate(string $name, string $theme = null)
Returns the correct candidate template. In order of importance, application project code, current theme and finally modules.
regenerate(bool $cache = true)
Regenerates the manifest by scanning the base path.