|
||||||||||
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
This is an object exposing a couple of methods useful for templates; it's 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)
Return the Node for the Given Path from the website repository. |
javax.jcr.Node |
content(String repository,
String path)
Return the Node 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. |
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)
FIXME Add a LinkUtil.createLink(Property property).... |
String |
link(String workspace,
String nodeIdentifier)
Create link for the Node identified by nodeIdentifier in the specified workspace. |
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)
|
SiblingsHelper |
siblings(ContentMap node)
|
SiblingsHelper |
siblings(javax.jcr.Node node)
Returns an instance of SiblingsHelper for the given node. |
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)
public String link(javax.jcr.Property property)
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)
public javax.jcr.Node content(String repository, String path)
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 javax.jcr.Node encode(javax.jcr.Node content)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |