Disable the background color option of one column.
.. code-block:: xml
Add parallax effect.
.. code-block:: xml
Add a black color filter with an opacity of 50%.
.. code-block:: xml
Add a white color filter with an opacity of 85%.
.. code-block:: xml
Add a custom color filter.
.. code-block:: xml
Add a custom gradient filter.
.. code-block:: xml
Styles
======
Compatibility system
--------------------
When a snippet has a `data-vcss` or `data-vjs` attribute, it means it is an updated version, not the
original one.
.. code-block:: xml
The `data-vcss` and `data-js` attributes indicate to the system which file version to load for that
snippet (e.g., :file:`001.js`, :file:`002.scss`).
Custom
======
Create the snippet's content.
**Declaration**
.. code-block:: xml
:caption: ``/website_airproof/views/snippets/s_airproof_snippet.xml``
.. warning::
`data-name` and `data-snippet` attributes have to be specified when a snippet is declared on a
theme page.
.. tip::
- Use Bootstrap native classes as much as possible.
- Prefix all your custom classes.
- Use underscore lowercase notation to name classes, e.g., `.x_nav`, `.x_nav_item`.
- Avoid using ID tag.
Add your custom snippet to the list of default snippets, so the user can drag and drop it on the
page, directly from the edit panel.
.. code-block:: xml
:caption: ``/website_airproof/views/snippets/options.xml``
.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 20 80
* - Attribute
- Description
* - t-snippet
- The template to use
* - t-thumbnail
- The path to the snippet thumbnail
Options
-------
Options allow users to edit a snippet's appearance using the Website Builder. You can create
snippet options easily and automatically add them to the Website Builder.
Groups properties
-----------------
Options are wrapped in groups. Groups can have properties that define how the included options
interact with the user interface.
`data-selector` binds all the options included in the group to a particular element. It can be used
in combination with `data-target` and `data-exclude`.
.. code-block:: xml
`data-js` binds custom JavaScript methods.
.. code-block:: xml
`data-drop-in` defines the list of elements where the snippet can be dropped into.
.. todo:: no css selector ...
.. code-block:: xml
`data-drop-near` defines the list of elements where the snippet can be dropped beside.
.. code-block:: xml
SCSS options
------------
Options can apply standard or custom CSS classes to the snippet. Depending on the method that you
choose, the user interface will behave differently.
`data-select-class="..."`
More `data-select-class` in the same group defines a list of classes the user can apply. Only one
option can be enabled at a time.
.. code-block:: xml
:caption: ``/website_airproof/views/snippets/options.xml``
Default
01
02
.. seealso::
`XML templates of the different snippets
<{GITHUB_PATH}/addons/website/views/snippets/snippets.xml>`_
JavaScript options
------------------
The `data-js` attribute can be assigned to an options group in order to define a custom method.
.. code-block:: javascript
import options from 'web_editor.snippets.options';
options.registry.CustomMethodName = options.Class.extend({
//
});
The Website Builder provides several events you can use to trigger your custom functions.
.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 20 80
* - Event
- Description
* - start
- Occurs when the publisher selects the snippet for the first time in an editing session or
when the snippet is drag-and-dropped on the page.
* - onFocus
- Occurs each time the snippet is selected by the user or when the snippet is drag-and-dropped
on the page.
* - onBlur
- Occurs when a snippet loses focus.
* - onClone
- Occurs just after a snippet is duplicated.
* - onRemove
- Occurs just before the snippet is removed.
* - onBuilt
- Occurs just after the snippet is drag-and-dropped on a drop zone. When this event is
triggered, the content is already inserted in the page.
* - cleanForSave
- Occurs before the publisher saves the page.
Dynamic Content templates
-------------------------
By default, Dynamic Content blocks have a selection of templates available in the Website Builder.
You can also add your own template to the list.
Blog posts
~~~~~~~~~~
.. code-block:: xml
:caption: ``/website_airproof/views/snippets/options.xml``
.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 20 80
* - Attribute
- Description
* - id
- The ID of the template. Has to start with `dynamic_filter_template_blog_post_`
* - name
- Human-readable name of the template
Products
~~~~~~~~
.. code-block:: xml
:caption: ``/website_airproof/views/snippets/options.xml``
.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 40 60
* - Attribute
- Description
* - id
- The ID of the template. Has to start with `dynamic_filter_template_product_product_`
* - name
- Human-readable name of the template
* - data-number-of-elements
- Number of products per slide on desktop
* - data-number-of-elements-sm
- Number of products per slide on mobile
* - data-number-of-elements-fetch
- The total amount of fetched products
Events
~~~~~~
.. code-block:: xml
:caption: ``/website_airproof/views/snippets/options.xml``
.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 20 80
* - Attribute
- Description
* - id
- The ID of the template. Has to start with `dynamic_filter_template_event_event_`
* - name
- Human-readable name of the template