Namespacing

Namespace your events for advanced CMS-driven use cases.

One of the common scenarios in which SA5 events are used are to support CMS-driven modals and pop-ups.

Example use cases;

  • You have a CMS-driven directory of employees. Clicking any employee's photos should display a pop-up containing that employee's info, also from the CMS.

  • You have a map, with map pins, populated from the CMS. Clicking a map pin should pop up information about the location, also from the CMS.

How Namespacing Works

In these situations, we need each individual trigger ( button ) and action ( modal display ) to be directly connected, but we also need them to be separated from other events.

Namespacing segregates these safely.

Usage Notes

The general usage pattern is;

  • Setup your triggers and actions as you usually would.

  • For the event name, data-bind the attribute value to the CMS item slug

e.g. sa-trigger-click = ( CMS item slug )

  • Add a unique namespace to both the trigger and the action

e.g. sa-trigger-click:ns = employee

Usage Notes Patterns

sa-trigger-*:ns = ( namespace )

All triggers support the :ns namespace suffix.

sa-action-*:ns = ( namespace )

All actions support the :ns namespace suffix.

Last updated

Was this helpful?