|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.templating.functions.TemplatingFunctions
public class TemplatingFunctions
An object exposing several methods useful for templates. It is exposed in templates as cmsfn
.
Constructor Summary | |
---|---|
TemplatingFunctions(javax.inject.Provider<AggregationState> aggregationStateProvider)
|
Method Summary | |
---|---|
List<ContentMap> |
ancestors(ContentMap contentMap)
|
List<ContentMap> |
ancestors(ContentMap contentMap,
String nodeTypeName)
|
List<javax.jcr.Node> |
ancestors(javax.jcr.Node content)
|
List<javax.jcr.Node> |
ancestors(javax.jcr.Node content,
String nodeTypeName)
|
ContentMap |
asContentMap(javax.jcr.Node content)
|
List<ContentMap> |
asContentMapList(Collection<javax.jcr.Node> nodeList)
|
protected List<ContentMap> |
asContentMapList(Iterable<javax.jcr.Node> nodes)
|
javax.jcr.Node |
asJCRNode(ContentMap contentMap)
|
List<javax.jcr.Node> |
asNodeList(Collection<ContentMap> contentMapList)
|
protected List<javax.jcr.Node> |
asNodeList(Iterable<javax.jcr.Node> nodes)
|
List<ContentMap> |
children(ContentMap content)
|
List<ContentMap> |
children(ContentMap content,
String nodeTypeName)
|
List<javax.jcr.Node> |
children(javax.jcr.Node content)
|
List<javax.jcr.Node> |
children(javax.jcr.Node content,
String nodeTypeName)
|
javax.jcr.Node |
content(String path)
Deprecated. use TemplatingFunctions.contentByPath(String path) or TemplatingFunctions.nodeByPath(String path) |
javax.jcr.Node |
content(String repository,
String path)
Deprecated. use TemplatingFunctions.contentByPath(String path, String workspace) or TemplatingFunctions.nodeByPath(String path, String workspace) |
ContentMap |
contentById(String id)
Return the ContentMap by the given identifier from the website repository. |
ContentMap |
contentById(String id,
String workspace)
Return the ContentMap by the given identifier from the given repository. |
javax.jcr.Node |
contentByIdentifier(String id)
Deprecated. use TemplatingFunctions.contentById(String id) or {@link TemplatingFunctions.nodeById(String id) |
javax.jcr.Node |
contentByIdentifier(String repository,
String id)
Deprecated. use TemplatingFunctions.contentById(String id, String workspace) or TemplatingFunctions.contentByPath(String id, String workspace) |
ContentMap |
contentByPath(String path)
Return the ContentMap for the Given Path from the website repository. |
ContentMap |
contentByPath(String path,
String workspace)
Return the ContentMap for the Given Path from the given repository. |
String |
createHtmlAttribute(String name,
String value)
Util method to create html attributes name="value" . |
ContentMap |
decode(ContentMap content)
Removes escaping of HTML on properties. |
javax.jcr.Node |
decode(javax.jcr.Node content)
Removes escaping of HTML on properties. |
ContentMap |
encode(ContentMap content)
Adds escaping of HTML on properties as well as changing line breaks into <br/> tags. |
javax.jcr.Node |
encode(javax.jcr.Node content)
Adds escaping of HTML on properties as well as changing line breaks into <br/> tags. |
String |
externalLink(ContentMap content,
String linkPropertyName)
Returns an external link prepended with http:// in case the protocol is missing or an empty String
if the link does not exist. |
String |
externalLink(javax.jcr.Node content,
String linkPropertyName)
Returns an external link prepended with http:// in case the protocol is missing or an empty String
if the link does not exist. |
String |
externalLinkTitle(ContentMap content,
String linkPropertyName,
String linkTitlePropertyName)
Return a link title based on the @param linkTitlePropertyName. |
String |
externalLinkTitle(javax.jcr.Node content,
String linkPropertyName,
String linkTitlePropertyName)
Return a link title based on the @param linkTitlePropertyName. |
ContentMap |
inherit(ContentMap content)
|
ContentMap |
inherit(ContentMap content,
String relPath)
|
javax.jcr.Node |
inherit(javax.jcr.Node content)
|
javax.jcr.Node |
inherit(javax.jcr.Node content,
String relPath)
|
List<ContentMap> |
inheritList(ContentMap content,
String relPath)
|
List<javax.jcr.Node> |
inheritList(javax.jcr.Node content,
String relPath)
|
javax.jcr.Property |
inheritProperty(ContentMap content,
String relPath)
|
javax.jcr.Property |
inheritProperty(javax.jcr.Node content,
String relPath)
|
boolean |
isAuthorInstance()
|
boolean |
isEditMode()
|
boolean |
isFromCurrentPage(ContentMap content)
|
boolean |
isFromCurrentPage(javax.jcr.Node content)
|
boolean |
isInherited(ContentMap content)
|
boolean |
isInherited(javax.jcr.Node content)
|
boolean |
isPreviewMode()
|
boolean |
isPublicInstance()
|
String |
language()
Get the language used currently. |
String |
link(ContentMap contentMap)
|
String |
link(javax.jcr.Node content)
|
String |
link(javax.jcr.Property property)
Deprecated. since 4.5.4. There is no valid use case for this method. |
String |
link(String workspace,
String nodeIdentifier)
Create link for the Node identified by nodeIdentifier in the specified workspace. |
String |
metaData(ContentMap content,
String property)
|
String |
metaData(javax.jcr.Node content,
String property)
Returns the string representation of a property from the metaData of the node or null if the node has no Magnolia metaData or if no matching property is found. |
javax.jcr.Node |
nodeById(String id)
Return the Node by the given identifier from the website repository. |
javax.jcr.Node |
nodeById(String id,
String workspace)
Return the Node by the given identifier from the given repository. |
javax.jcr.Node |
nodeByPath(String path)
Return the Node for the Given Path from the website repository. |
javax.jcr.Node |
nodeByPath(String path,
String workspace)
Return the Node for the Given Path from the given repository. |
ContentMap |
page(ContentMap content)
Returns the page's ContentMap of the passed ContentMap . |
javax.jcr.Node |
page(javax.jcr.Node content)
Returns the page Node of the passed node. |
ContentMap |
parent(ContentMap contentMap)
|
ContentMap |
parent(ContentMap contentMap,
String nodeTypeName)
|
javax.jcr.Node |
parent(javax.jcr.Node content)
|
javax.jcr.Node |
parent(javax.jcr.Node content,
String nodeTypeName)
|
ContentMap |
root(ContentMap contentMap)
|
ContentMap |
root(ContentMap contentMap,
String nodeTypeName)
|
javax.jcr.Node |
root(javax.jcr.Node content)
|
javax.jcr.Node |
root(javax.jcr.Node content,
String nodeTypeName)
|
Collection<javax.jcr.Node> |
search(String workspace,
String statement,
String language,
String returnItemType)
Executes query and returns result as Collection of Nodes. |
SiblingsHelper |
siblings(ContentMap node)
|
SiblingsHelper |
siblings(javax.jcr.Node node)
Returns an instance of SiblingsHelper for the given node. |
Collection<javax.jcr.Node> |
simpleSearch(String workspace,
String statement,
String returnItemType,
String startPath)
Executes simple SQL2 query and returns result as Collection of Nodes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@Inject public TemplatingFunctions(javax.inject.Provider<AggregationState> aggregationStateProvider)
Method Detail |
---|
public javax.jcr.Node asJCRNode(ContentMap contentMap)
public ContentMap asContentMap(javax.jcr.Node content)
public List<javax.jcr.Node> children(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> children(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<ContentMap> children(ContentMap content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<ContentMap> children(ContentMap content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ContentMap root(ContentMap contentMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ContentMap root(ContentMap contentMap, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node root(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node root(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ContentMap parent(ContentMap contentMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ContentMap parent(ContentMap contentMap, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node parent(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node parent(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ContentMap page(ContentMap content) throws javax.jcr.RepositoryException
ContentMap
of the passed ContentMap
. If the passed ContentMap
represents a page, the passed ContentMap
will be returned.
If the passed ContentMap
has no parent page at all, null is returned.
content
- the ContentMap
to get the page's ContentMap
from.
ContentMap
of the passed content ContentMap
.
javax.jcr.RepositoryException
public javax.jcr.Node page(javax.jcr.Node content) throws javax.jcr.RepositoryException
Node
of the passed node. If the passed Node
is a page, the passed Node
will be returned.
If the passed Node has no parent page at all, null is returned.
content
- the Node
to get the page from.
Node
of the passed content Node
.
javax.jcr.RepositoryException
public List<ContentMap> ancestors(ContentMap contentMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<ContentMap> ancestors(ContentMap contentMap, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> ancestors(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> ancestors(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node inherit(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node inherit(javax.jcr.Node content, String relPath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ContentMap inherit(ContentMap content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ContentMap inherit(ContentMap content, String relPath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Property inheritProperty(javax.jcr.Node content, String relPath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Property inheritProperty(ContentMap content, String relPath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> inheritList(javax.jcr.Node content, String relPath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<ContentMap> inheritList(ContentMap content, String relPath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public boolean isInherited(javax.jcr.Node content)
public boolean isInherited(ContentMap content)
public boolean isFromCurrentPage(javax.jcr.Node content)
public boolean isFromCurrentPage(ContentMap content)
public String link(String workspace, String nodeIdentifier)
@Deprecated public String link(javax.jcr.Property property)
link(Node)
while passing parent node as a parameter. In case you find other valid reason to use this method, please raise it in a forum discussion or create issue. Otherwise this method will be removed in the future.
public String link(javax.jcr.Node content)
public String link(ContentMap contentMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public String language()
public String externalLink(javax.jcr.Node content, String linkPropertyName)
http://
in case the protocol is missing or an empty String
if the link does not exist.
content
- The node where the link property is stored on.linkPropertyName
- The property where the link value is stored in.
http://
public String externalLink(ContentMap content, String linkPropertyName)
http://
in case the protocol is missing or an empty String
if the link does not exist.
content
- The node's map representation where the link property is stored on.linkPropertyName
- The property where the link value is stored in.
http://
public String externalLinkTitle(javax.jcr.Node content, String linkPropertyName, String linkTitlePropertyName)
http://
).
content
- The node where the link property is stored on.linkPropertyName
- The property where the link value is stored in.linkTitlePropertyName
- The property where the link title value is stored
public String externalLinkTitle(ContentMap content, String linkPropertyName, String linkTitlePropertyName)
http://
).
content
- The node where the link property is stored on.linkPropertyName
- The property where the link value is stored in.linkTitlePropertyName
- The property where the link title value is stored
public boolean isEditMode()
public boolean isPreviewMode()
public boolean isAuthorInstance()
public boolean isPublicInstance()
public String createHtmlAttribute(String name, String value)
name="value"
. If the value is empty an empty string will be returned.
This is mainly helpful to avoid empty attributes.
public SiblingsHelper siblings(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public SiblingsHelper siblings(ContentMap node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node content(String path)
TemplatingFunctions.contentByPath(String path)
or TemplatingFunctions.nodeByPath(String path)
public javax.jcr.Node content(String repository, String path)
TemplatingFunctions.contentByPath(String path, String workspace)
or TemplatingFunctions.nodeByPath(String path, String workspace)
public javax.jcr.Node contentByIdentifier(String id)
TemplatingFunctions.contentById(String id)
or {@link TemplatingFunctions.nodeById(String id)
public javax.jcr.Node contentByIdentifier(String repository, String id)
TemplatingFunctions.contentById(String id, String workspace)
or TemplatingFunctions.contentByPath(String id, String workspace)
public ContentMap contentByPath(String path)
public ContentMap contentByPath(String path, String workspace)
public ContentMap contentById(String id)
public ContentMap contentById(String id, String workspace)
public javax.jcr.Node nodeByPath(String path)
public javax.jcr.Node nodeByPath(String path, String workspace)
public javax.jcr.Node nodeById(String id)
public javax.jcr.Node nodeById(String id, String workspace)
public List<ContentMap> asContentMapList(Collection<javax.jcr.Node> nodeList)
public List<javax.jcr.Node> asNodeList(Collection<ContentMap> contentMapList)
protected List<javax.jcr.Node> asNodeList(Iterable<javax.jcr.Node> nodes)
protected List<ContentMap> asContentMapList(Iterable<javax.jcr.Node> nodes)
public ContentMap decode(ContentMap content)
public javax.jcr.Node decode(javax.jcr.Node content)
public ContentMap encode(ContentMap content)
public javax.jcr.Node encode(javax.jcr.Node content)
public String metaData(javax.jcr.Node content, String property)
null
if the node has no Magnolia metaData or if no matching property is found.
public String metaData(ContentMap content, String property)
TemplatingFunctions#metaData(Node, String)}.
public Collection<javax.jcr.Node> search(String workspace, String statement, String language, String returnItemType)
statement
- has to be in formal form for chosen languagepublic Collection<javax.jcr.Node> simpleSearch(String workspace, String statement, String returnItemType, String startPath)
statement
- should be set of labels target has to contain inserted as one string each separated by commastartPath
- can be inserted, for results without limitation set it to slash
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |