\DynamicTemplateManifest
This is a representation of the contents of the manifest file. The manifest is cached in a serialised form of this class. It also provides functions for manipulating manifests by the admin interface.
Synopsis
class DynamicTemplateManifest
{
- // methods
- public void __construct()
- public void getModified()
- public void setModified()
- public void hasPath()
- public void addPath()
- public static String get_extension()
- public void removePath()
- public void syncLinks()
- public DynamicTemplateManifest loadFromFile()
- public bool appliesToClass()
- public array defaultMetadata()
- public void parseMetadata()
- public String generateFileContent()
- public void setTemplateType()
- public void getTemplatesForRendering()
- public void getCssForRendering()
- public void getJavascriptForRendering()
Tasks
Line | Task |
---|---|
+ | Document structure with more detail. |
Members
protected
-
$modified
This is set to true by methods that change the manifest object in such a way it needs to be written back to the file system.
public
-
$actions
The actions in this manifest. Each action is an array of sections, and each section is an array of files in that section. The canonical sections we're interested in are 'templates', 'css' and 'javascript', which are the only types of file in a dynamic template that can be included in a page using Requirements, or rendered with SSViewer. -
$extMap
Map file extensions to the subfolder they sit in within the template. -
$metadata
A map that holds metadata about the template. Currently the only understood key is 'classes' which is a list of PHP classes and their descendents to which this dynamic template can be applied.
Methods
public
- __construct()
- addPath()
- appliesToClass() — Return true if this dynamic template can be applied to a specified class.
- defaultMetadata() — Return whatever is the default metadata.
- generateFileContent() — Generate a MANIFEST file from the manifest object.
- getCssForRendering()
- getJavascriptForRendering()
- getModified()
- getTemplatesForRendering() — Return an array of the templates for rendering the given action. This has to rearrange template structure from the manifest slightly. Returns a map with keys "main" and "Layout" as appropriate, with a base-relative path to the template file, suitable for giving to SSViewer/
- get_extension() — Helper function to get the extension of a file given it's path.
- hasPath() — Return true if the manifest contains a link to the supplied path. This is assumed to be relative to site root.
- loadFromFile() — Given the content of a MANIFEST file, parse the file into an object.
- parseMetadata() — Generate normalise metadata for the manifest from the given definition from the MANIFEST file. Manipulates $manifest and adds definitions as appropriate.
- removePath() — Remove a path from the action if it's there.
- setModified() — Set modified flag. Generally this is only called by DynamicTemplate::flushManifest.
- setTemplateType() — Change the type of a template. If there is a template that has that type, it's type will be reset so there is only one of any given type.
- syncLinks() — Synchronise links within an action to a given list of links.