Skip to main content

Module layout

Module layout 

Source
Expand description

Layout blocks: Cards, Slider and Gallery, each a list of items an editor adds one by one (BlockField::Repeat over an item block: card, slide, gallery_image).

The templates (blocks/<type>.html) emit plain markup with rcms-block-* classes and no styles, so a site’s own stylesheet lays them out; the starter themes style all three. A slider works without JavaScript (it scrolls sideways with snap points); a theme may add previous/next buttons on top.

Item links go through the safe_href filter (safe_href), so an editor’s link can be a site path or a web, mail or phone address, never javascript: or another scheme.

Structs§

CardBlock
One card of a Cards block.
CardsBlock
cards: a grid of cards, each with an image, a title, text and a link.
GalleryBlock
gallery: any number of pictures in a grid; each opens full size.
GalleryImageBlock
One picture of a Gallery block.
SlideBlock
One slide of a Slider block.
SliderBlock
slider: slides that scroll sideways, one at a time or several in a row.

Functions§

safe_href
A link fit for an href: a site path (/about, not //host), a fragment, or an http(s), mailto or tel address. Anything else (javascript:, data:, a bare word) is None.