fluent_contents.templatetags.fluent_contents_tags¶
Changed in version 1.0: The template tag library was called placeholder_tags
in the past.
The fluent_contents_tags
module provides two template tags for rendering placeholders:
It can be loaded using:
{% load fluent_contents_tags %}
A placeholder which is stored in a PlaceholderField
can
be rendered with the following syntax:
{% render_placeholder someobject.placeholder %}
To support CMS interfaces, placeholder slots can be defined in the template. This is done using the following syntax:
{% page_placeholder currentpage "slotname" %}
{% page_placeholder currentpage "slotname" title="Admin title" role="main" %}
The CMS interface can scan for those tags using the fluent_contents.analyzer module.
The PagePlaceholderNode
class¶
The template node of the
page_placeholder
tag. It renders a placeholder of a provided parent object. The template tag can also contain additional metadata, which can be returned by scanning for this node using the fluent_contents.analyzer module.The constructor receives the parsed arguments. The values are stored in
tagname
,args
,kwargs
.
Return whether to use the fallback language.
Return the string literal that is used in the template. The role can be “main”, “sidebar” or “related”, or shorted to “m”, “s”, “r”.
Return the string literal that is used for the placeholder slot in the template. When the variable is not a string literal,
None
is returned.
Return the string literal that is used in the template. The title is used in the admin screens.
Return the value for the tag.
Parameters: - tag_args –
- tag_kwargs –
Parse the node syntax:
{% page_placeholder parentobj slotname title="test" role="m" %}
The RenderPlaceholderNode
class¶
The template node of the
render_placeholder
tag. It renders the provided placeholder object.Return the value for the tag.
Parameters: - tag_args –
- tag_kwargs –
Validate the syntax of the template tag.
The RenderContentItemsMedia
class¶
The template node of the
render_plugin_media
tag. It renders the media object object.Render the tag, with all arguments resolved to their actual values.
Validate the syntax of the template tag.