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

__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()

No description

string
getCacheKey(boolean $includeTests = false)

Generate a unique cache key to avoid manifest cache collisions.

array
getTemplates()

Returns a map of all template information. The map is in the following format:

array
getTemplate(string $name)

Returns a set of possible candidate templates that match a certain template name.

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.

handleFile($basename, $pathname, $depth)

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.

Parameters

string $base The base path.
string $project Path to application code
bool $includeTests Include tests in the manifest.
bool $forceRegen Force the manifest to be regenerated.

at line 50
string getBase()

Return Value

string

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.

Parameters

boolean $includeTests

Return Value

string

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' ) ) ) )

Return Value

array

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()}.

Parameters

string $name

Return Value

array

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.

Parameters

string $name
string $theme
  • theme name

Return Value

array

at line 163
regenerate(bool $cache = true)

Regenerates the manifest by scanning the base path.

Parameters

bool $cache

at line 181
handleFile($basename, $pathname, $depth)

Parameters

$basename
$pathname
$depth