Product support

Visit this product's website for support.


One of the great features of RainLab Static Pages plugin is the Snippets feature. It allows the developer to hand over management of complex items, such as forms, maps, widgets, etc to the client. For more information on what a Snippet is, please see https://github.com/rainlab/pages-plugin#snippets.

This plugin simply extends the ability to re-use these snippets from any richeditor by providing an additional dropdown to the Froala Richeditor with a list of available snippets (supports partial and component based snippets). It also provides a twig filter to allow the parsing of implemented snippets. Example usage:

{{ content | parseSnippets }}

For documentation regarding creating snippets, please see https://github.com/rainlab/pages-plugin#snippets-created-from-partials


  • Allows Snippets of code to be added from any RichEditor
  • Doesn't require any additional configuration
  • Provides Twig filter to easily parse Snippets
  • PHP and Twig sections work as expected inside Snippets
  • Works with component and partial based Snippets


In a default October 1 installation, this plugin automatically injects itself to appear in the richeditor toolbar.

But if you customize the "Toolbar Buttons" in the "Editor settings", you may want to add snippets in the list, otherwise the button will not appear anymore.

Note for October 2 and 3 users: actually we are not able to inject ourselves in the new richeditor toolbar. You will also need to configure it manually in the CMS settings.

To render the snippets in your theme, you will need to apply the parseSnippets filter to the variables containing richeditor content (see below).

Example usage on generic variable

{{ content | parseSnippets }}

Example usage for RainLab Pages Syntax Fields

Option 1 (offset to variable)

{variable type="richeditor" tab="Content" name="text" label="Text"}{/variable}
{{ text | parseSnippets }}

Option 2 (wrap in apply/filter)

{% apply parseSnippets %}
    {richeditor tab="Content" name="text" label="Text"}{/richeditor}
{% endapply %}

Example usage for Rainlab Pages Content Blocks

{% apply parseSnippets %}
    {% content 'company-details.htm' %}
{% endapply %}

Note this method is useful if you are including a third party component that will output richeditors but you don't want to override its partial.

For example if you are using a richeditor with Rainlab.Blog, you may want to include the component as follow in your CMS page:

{% apply parseSnippets %}
    {% component 'blogPost' %}
{% endapply %}

Example usage in fields.yaml

If you do not set toolbarButtons you will not need to add snippets to the list. Please see example below when customization is required.

    type: richeditor
    toolbarButtons: bold|italic|snippets
    size: huge

Pass extra parameters

If needed, you can pass extra parameters to your snippets from your theme like this:

{{ text | parseSnippets({context: 'foo'}) }}
{% apply parseSnippets({context: 'foo'}) %}
    {richeditor name="text" label="Text"}{/richeditor}
{% endapply %}

You will then be able to access context as if it was a component property using $this->property('context').


  • Found the plugin useful on 25 Oct, 2018

    Awesome! Wanted the ability to add snippets to blog post content, and this does it perfectly...

    To anyone looking for help on how to change the editor on Blog Posts then read this - https://octobercms.inetis.ch/wysiwyg-editor-rainlab-blog

  • Found the plugin useful on 11 Oct, 2018

    I have added this plugin to my website cause i had an issue with snippets into my repeater fields for Static pages and it works perfectly

    Thanks for this work :)


Fix some cases where content between two snippets could be stripped

Apr 11, 2024


Support for basic HTML in snippet properties - Thanks @grwllrnc

Mar 27, 2024


Support for October 3.4 and up - Thanks @xmelic8

Nov 27, 2023


Load the proper active theme when using multisite on October 3

Mar 27, 2023


Remove snippet button from editor when user doesn't have permission to fetch snippets list (rainlab.pages.access_snippets) - Thanks @tschortsch

Mar 22, 2023


Avoid storing an empty array in cache when no snippets are passed

Apr 11, 2022


Fix compatibility with OC2 when used in plugins other than RainLab.Pages

Jan 10, 2022


Add composer.json to allow installation on OC2 - Thanks @rubenvanerk for pointing this out

Jul 30, 2021


Fix error "Trying to access array offset on value of type null" that could happen under unknown circumstances

Dec 17, 2020


Fix duplicate stuff on RainLab.Pages (open page twice, add snippet twice, etc.)

Sep 08, 2020


Fix broken error message when a snippet is not found - Thanks to Tobias Kündig

May 11, 2020


Refactor AJAX handlers caching

Apr 20, 2020


Fix AJAX handlers on component-based snippets

Mar 23, 2020


Add support for component-based snippets with AJAX handlers

Nov 06, 2018


Fixes for October >= 420

Jul 18, 2018


Fixes error 'onInspectableGetOptions not found' on more complex snippets

Jul 18, 2018


Defines Rainlab.Pages as a plugin dependency - Thanks to Alexander Guth

Jul 18, 2018


First version of Richeditor Snippets

Jul 18, 2018