[include:] Short Tag
Built-in Feature / Renderer Plugin
This "short tag" allows displaying a Content Block within the content of any Item/Post or even another Content Block.
It has an alias [cblock:] Short Tag.
IMPORTANT:
[include:]
is actually processed by the Include Content Block Plugin (and the built-in short tag exists only as a fallback TODO to be removed at some point) because using a renderer plugin allows to include content before other renderer execute, for example the Table of Contents Plugin.Note:
[include:content-block-slug]
includes content from another Item, which may contain one or more block elements (<div>...</div>
or <p>...</p>
). The whole content block also gets wrapped into a wrapping <div>
. Therefore this tag cannot appear inside a paragraph. (b2evolution will automatically move it out of the paragraph).Syntax Breakdown
[include:
Item ID or slug [ :
template_code ] [ :.
Class Name(s) ] ]
- Item ID or slug: ID or slug of the Item to include. It must have content Type "Content Block".
- Template code : Optional Code name of Quick Template to use to format the display of the Content Block. Default template
cblock_clearfix
is used if this option is not provided. - Class Name(s) : Optional CSS class name(s). The class name must start with a dot. Multiple class names can be specified, separated by a dot. See CSS Classes
- The CSS classes will be injected into a wrapping
<div>
. See$cb_class$
in the technical info below. - The class
.*
will be replaced with item slug automatically.
- The CSS classes will be injected into a wrapping
Examples
[include:123]
Display a content block Item with ID #123[include:content-block-slug]
Display a content block Item with slugcontent-block-slug
. The content block will be wrapped with the default "clearfix" template.[include:content-block-slug:cblock_noclearfix]
Display a content block Item with slugcontent-block-slug
by using a different wrapper template, in this case to avoid "clearfix".[include:content-block-slug:.*.alert.alert-warning]
Display the content block in an orange warning box (using default Bootstrap CSS styles)[include:content-block-slug:.class1.*.class3]
Display a content block Item with slugcontent-block-slug
in wrapper similar to:
<div class="class1 content-block-slug class3">Item content block text</div>
Technical info
The contents of the content block will be wrapped using these Container Params:
'content_block_start' => '<div class="evo_content_block $cb_class$">',
'content_block_end' => '</div>',
'content_block_before_images' => '<div class="evo_content_block_images">',
'content_block_after_images' => '</div>',
'content_block_before_text' => '<div class="evo_content_block_text">',
'content_block_after_text' => '</div>',
Which mean we get something like this:
<div class="evo_content_block $cb_class$">',
<div class="evo_content_block_images">
...the teaser image(s) of the content block...
</div>
<div class="evo_content_block_text">
...the text/paragraphs of the content block...
</div>
</div>
Restrictions
- The referenced Item must exist
- The referenced Item must be of Item Usage content block
- The Visibility status of the content block Item cannot be higher than status of the current/parent Item,
See below the ordered list of visibility statuses by weight:- Redirected
- Public
- Community
- Deprecated
- Protected
- Private
- Draft
- Review
For example, if content block Item has a status "Public" but current/parent Item has a status "Community",
then such content block Item cannot be included into the current/parent Item.
- At least one of the following permissions must be true:
- The Content block has the same owner as the parent Item
- The Content block has the same owner as the parent Item’s Collection
- The Content block Item is in the same collection as the parent Item
- The Content block Item is in the shared content blocks collection.