|
||||||||||
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<info.magnolia.cms.core.AggregationState> aggregationStateProvider)
|
Method Summary | |
---|---|
List<info.magnolia.jcr.util.ContentMap> |
ancestors(info.magnolia.jcr.util.ContentMap contentMap)
|
List<info.magnolia.jcr.util.ContentMap> |
ancestors(info.magnolia.jcr.util.ContentMap contentMap,
String nodeTypeName)
|
List<javax.jcr.Node> |
ancestors(javax.jcr.Node content)
|
List<javax.jcr.Node> |
ancestors(javax.jcr.Node content,
String nodeTypeName)
|
info.magnolia.jcr.util.ContentMap |
asContentMap(javax.jcr.Node content)
|
List<info.magnolia.jcr.util.ContentMap> |
asContentMapList(Collection<javax.jcr.Node> nodeList)
|
protected List<info.magnolia.jcr.util.ContentMap> |
asContentMapList(Iterable<javax.jcr.Node> nodes)
|
javax.jcr.Node |
asJCRNode(info.magnolia.jcr.util.ContentMap contentMap)
|
List<javax.jcr.Node> |
asNodeList(Collection<info.magnolia.jcr.util.ContentMap> contentMapList)
|
protected List<javax.jcr.Node> |
asNodeList(Iterable<javax.jcr.Node> nodes)
|
List<info.magnolia.jcr.util.ContentMap> |
children(info.magnolia.jcr.util.ContentMap content)
|
List<info.magnolia.jcr.util.ContentMap> |
children(info.magnolia.jcr.util.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) |
info.magnolia.jcr.util.ContentMap |
contentById(String id)
Return the ContentMap by the given identifier from the website repository. |
info.magnolia.jcr.util.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) |
info.magnolia.jcr.util.ContentMap |
contentByPath(String path)
Return the ContentMap for the Given Path from the website repository. |
info.magnolia.jcr.util.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" . |
info.magnolia.jcr.util.ContentMap |
decode(info.magnolia.jcr.util.ContentMap content)
Removes escaping of HTML on properties. |
javax.jcr.Node |
decode(javax.jcr.Node content)
Removes escaping of HTML on properties. |
info.magnolia.jcr.util.ContentMap |
encode(info.magnolia.jcr.util.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(info.magnolia.jcr.util.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(info.magnolia.jcr.util.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. |
info.magnolia.jcr.util.ContentMap |
inherit(info.magnolia.jcr.util.ContentMap content)
|
info.magnolia.jcr.util.ContentMap |
inherit(info.magnolia.jcr.util.ContentMap content,
String relPath)
|
javax.jcr.Node |
inherit(javax.jcr.Node content)
|
javax.jcr.Node |
inherit(javax.jcr.Node content,
String relPath)
|
List<info.magnolia.jcr.util.ContentMap> |
inheritList(info.magnolia.jcr.util.ContentMap content,
String relPath)
|
List<javax.jcr.Node> |
inheritList(javax.jcr.Node content,
String relPath)
|
javax.jcr.Property |
inheritProperty(info.magnolia.jcr.util.ContentMap content,
String relPath)
|
javax.jcr.Property |
inheritProperty(javax.jcr.Node content,
String relPath)
|
boolean |
isAuthorInstance()
|
boolean |
isEditMode()
|
boolean |
isFromCurrentPage(info.magnolia.jcr.util.ContentMap content)
|
boolean |
isFromCurrentPage(javax.jcr.Node content)
|
boolean |
isInherited(info.magnolia.jcr.util.ContentMap content)
|
boolean |
isInherited(javax.jcr.Node content)
|
boolean |
isPreviewMode()
|
boolean |
isPublicInstance()
|
String |
language()
Get the language used currently. |
String |
link(info.magnolia.jcr.util.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(info.magnolia.jcr.util.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. |
info.magnolia.jcr.util.ContentMap |
page(info.magnolia.jcr.util.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. |
info.magnolia.jcr.util.ContentMap |
parent(info.magnolia.jcr.util.ContentMap contentMap)
|
info.magnolia.jcr.util.ContentMap |
parent(info.magnolia.jcr.util.ContentMap contentMap,
String nodeTypeName)
|
javax.jcr.Node |
parent(javax.jcr.Node content)
|
javax.jcr.Node |
parent(javax.jcr.Node content,
String nodeTypeName)
|
info.magnolia.jcr.util.ContentMap |
root(info.magnolia.jcr.util.ContentMap contentMap)
|
info.magnolia.jcr.util.ContentMap |
root(info.magnolia.jcr.util.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. |
info.magnolia.cms.util.SiblingsHelper |
siblings(info.magnolia.jcr.util.ContentMap node)
|
info.magnolia.cms.util.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<info.magnolia.cms.core.AggregationState> aggregationStateProvider)
Method Detail |
---|
public javax.jcr.Node asJCRNode(info.magnolia.jcr.util.ContentMap contentMap)
public info.magnolia.jcr.util.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<info.magnolia.jcr.util.ContentMap> children(info.magnolia.jcr.util.ContentMap content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> children(info.magnolia.jcr.util.ContentMap content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap root(info.magnolia.jcr.util.ContentMap contentMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap root(info.magnolia.jcr.util.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 info.magnolia.jcr.util.ContentMap parent(info.magnolia.jcr.util.ContentMap contentMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap parent(info.magnolia.jcr.util.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 info.magnolia.jcr.util.ContentMap page(info.magnolia.jcr.util.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<info.magnolia.jcr.util.ContentMap> ancestors(info.magnolia.jcr.util.ContentMap contentMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> ancestors(info.magnolia.jcr.util.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 info.magnolia.jcr.util.ContentMap inherit(info.magnolia.jcr.util.ContentMap content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap inherit(info.magnolia.jcr.util.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(info.magnolia.jcr.util.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<info.magnolia.jcr.util.ContentMap> inheritList(info.magnolia.jcr.util.ContentMap content, String relPath) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public boolean isInherited(javax.jcr.Node content)
public boolean isInherited(info.magnolia.jcr.util.ContentMap content)
public boolean isFromCurrentPage(javax.jcr.Node content)
public boolean isFromCurrentPage(info.magnolia.jcr.util.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(info.magnolia.jcr.util.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(info.magnolia.jcr.util.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(info.magnolia.jcr.util.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 info.magnolia.cms.util.SiblingsHelper siblings(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public info.magnolia.cms.util.SiblingsHelper siblings(info.magnolia.jcr.util.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 info.magnolia.jcr.util.ContentMap contentByPath(String path)
public info.magnolia.jcr.util.ContentMap contentByPath(String path, String workspace)
public info.magnolia.jcr.util.ContentMap contentById(String id)
public info.magnolia.jcr.util.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<info.magnolia.jcr.util.ContentMap> asContentMapList(Collection<javax.jcr.Node> nodeList)
public List<javax.jcr.Node> asNodeList(Collection<info.magnolia.jcr.util.ContentMap> contentMapList)
protected List<javax.jcr.Node> asNodeList(Iterable<javax.jcr.Node> nodes)
protected List<info.magnolia.jcr.util.ContentMap> asContentMapList(Iterable<javax.jcr.Node> nodes)
public info.magnolia.jcr.util.ContentMap decode(info.magnolia.jcr.util.ContentMap content)
public javax.jcr.Node decode(javax.jcr.Node content)
public info.magnolia.jcr.util.ContentMap encode(info.magnolia.jcr.util.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(info.magnolia.jcr.util.ContentMap content, String property)
TemplatingFunctions#metaData(Node, String)}.
public Collection<javax.jcr.Node> search(String workspace, String statement, String language, String returnItemType)
workspace
- statement
- has to be in formal form for chosen languagelanguage
- returnItemType
- public Collection<javax.jcr.Node> simpleSearch(String workspace, String statement, String returnItemType, String startPath)
workspace
- statement
- should be set of labels target has to contain inserted as one string each separated by commareturnItemType
- startPath
- 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 |