Skip to content

v6+Board management

Board groups

Board groups allow the editor to add and order a series of boards. To add a board group:

html
    {{ wf_cms_board_group('SLUG_OF_THE_BOARD_GROUP', [
        {
            template: 'board/breaking-news',
            title: 'Breaking news',
            type: 'homepage'
        },
        {
            template: 'board/homepage-opening',
            title: 'Homepage opening',
            type: 'homepage'
        }
    }}

wf_cms_board_group takes two arguments:

  • SLUG_OF_THE_BOARD_GROUP is a unique identifier for the board group
  • an array with the definitions of boards allowed in this group. Each definition should contain:
    • template: the path to the template file, relative to __CMS_BUNDLE__/Resources/views/Templates
    • title: the text to be shown in the list of possible boards to be added
    • type: can be one of board (generic), homepage or metatags. The metatags type is special since it uses a custom renderer to render the metatags in public. homepage is only saved in the database as page_type, but not used for other purposes.

When rendering a board group, a button will appear in the bottom right corner of the browser allowing the editor to add/order as many boards as they want using the defined templates.

Note: In development mode the board group automatically caps the number of boards to 3 to avoid high refresh times.

Boards

General usage

For single boards, one instance per project - e.g. homepage/header/footer boards

html
{{ wf_cms_render_board('opening', {
    template: 'board/home/opening',
    title: 'board-title.opening'|trans,
}) }}

For multiple boards, one for each entity - e.g. one board for each category/tag/author

html
{{ wf_cms_render_board('category-secondary', {
    template: 'board/category/secondary',
    title: 'board-title.category-secondary'|trans,
    entity: category
}) }}

Note that the slug for the template boards is the base slug (category-secondary in this example), XalokNext creates a final slug based on the entity type and id passed.

If one wants to display a fallback board (allow editing a specific board or display a predetermined board), use the wf_cms_render_array_board twig function. The following example shows displaying a board with slug ads, overwritable for each article template:

html
{{ wf_cms_render_array_board(['ads-' ~ page.template, 'ads'], {
    template: 'board/ads',
    title: 'board-title.ads'|trans,
}) }}

Disabling the "board template" board

When editing the board rendered by this example (a board with the entity option passed):

html
{{ wf_cms_render_board('category-secondary', {
    template: 'board/category/secondary',
    title: 'board-title.category-secondary'|trans,
    entity: category
}) }}

XalokNext offers the editor the possibility to edit two boards: one for the board related to that category and another "board template", that will be used for those categories that don't have a category-secondary board published. This is to ease setting up the look and feel: editing the category-secondary "board template" will have this board shown for all categories. Then, a specific category can edit its own specific category-secondary and this will be shown only for that specific category.

Note: the above applies for all types of entity, category was used here only to (hopefully) help simplify the wording 😃

To disable the "board template" and edit only the entity specific board, pass the useTemplate option with a false value:

html
{{ wf_cms_render_board('category-secondary', {
    template: 'board/category/secondary',
    title: 'board-title.category-secondary'|trans,
    entity: category
    useTemplate: false
}) }}

Query passthrough

In case of not using AJAX for listings' pagination, or for search listings, the query variables coming from the top request would have to be passed through the board including that listing. The automated listing module would then pass through the query variables to the action that generates the contents of that listing. To do so:

html
{{ wf_cms_render_board('search-listing', {
    template: 'board/search/listing',
    title: 'board-title.search-listing'|trans,
    queryPassThrough: true
}) }}

v7.1+ Excluding IDs in Listings

To exclude specific IDs from the listings, you can use the wf_cms_render_board function with the renderContext parameter. This is particularly useful in scenarios where you need to exclude the current page ID from the listing, or if you need to pass an array of IDs to exclude multiple articles.

Here is how you can do it:

html
{{ wf_cms_render_board('article-related-content', {
    template: 'board/article/related',
    title: 'board-title.article-related'|trans,
    entity: article.category,
    queryPassThrough: true,
    renderContext: {
        excludeIds: [article.id]
    }
}) }}

v7.1+ Render context

In the case of excludeIds above, that value is already consumed by the ListingPageRenderer, there's no need to do anything else. But the render context can be used to pass data from PHP/Twig to the JavaScript code too. Read here for details.

Listing ads boards

See the documentation here: Dynamic listing add advertisement boards option.