new Layout(name, definition)
The Layout class
The constructor parses the layout and divides them into containers (headerContents, bodyContents, dialogsContents).
Name | Type | Description |
---|---|---|
name |
String | Name of the Layout (usually the same name as the Layout's controller). |
definition |
String | Layout description, i.e. the raw template code that will be processed. May be empty: in this case the processed contents must be added manually (cf. parser.StorageUtils) |
Requires
- module:if
- module:if
Classes
Members
-
bodyAttributesObject
-
A JSON-like object containing the attributes of the BODY-tag as String values. For example, for the following BODY-tag:
{ "onload": "handleOnLoad()", "class": "some css-classes" }
- Default Value:
- undefined
-
bodyContentElementContentElement
-
The (parsed) content for the body-container.
-
bodyContentsString
-
This variable holds the contents of the body part of the layout.
- Deprecated
- unused
-
defObject
-
The definition string of the layout (ehtml-format, taken from assets/www/views/layout/*.ehtml)
-
dialogsContentsString
-
This variable holds the contents of the dialogs part of the layout.
-
headerContentsString
-
This variable holds the contents of the header part of the layout.
- Deprecated
- unused
-
headerElementsArray.<Layout.TagElement>
-
List for extracted & parsed SCRIPT, LINK and STYLE tags
-
nameString
-
The name of the layout.
-
titleString
-
The page / layout title Will be extracted from definition's TITLE-tag, if present.
-
yieldsArray
-
A list holding the content-references (yield declarations) for the containers (except for body): header, footer, and dialogs
Methods
-
private,staticLayout.getTagAttr(str, target){Object}
-
HELPER: extracts TAG attributes into an JSON-object
Name Type Description str
String the start-TAG as String target
Object optional OPTIONAL the target-object to which the extracted attributes will be attached if omitted, a new, empty object will be created Returns:
object with the extracted attributes as properties (if target was provided, then this is the target object)
Example
e.g. --> {"onload": "on_load()", "class": "biggestFont"}
-
protected_extHeaderElements()
-
HELPER: add prototype functions of Layout.TagElement to the #headerElements
-
getBodyContents(){String}
-
This methods returns the contents of the body part of the layout.
Returns:
contents of the body part of the layout
-
getDialogsContents(){String}
-
This methods returns the contents of the dialog part of the layout.
Returns:
contents of the dialog part of the layout
-
getHeaderContents(){String}
-
This methods returns the contents of the header part of the layout.
Returns:
contents of the header part of the layout
-
getName(){String}
-
Gets the name of the layout.
Returns:
name of the layout.
-
getYields(){Array}
-
This methods returns an associative array holding the contents of the different containers: header, body, footer and dialogs.
Returns:
associative array holding the contents of the different containers: header, body, footer and dialogs