Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1.29 KB

areas.md

File metadata and controls

27 lines (17 loc) · 1.29 KB
description Reusable collections of widgets, rendered by slug.

Areas

An area is a named list of widgets. Editors create them under CMS → Areas. Each area has a label, a slug (taken from the label), a description for other editors, and the widget data itself.

The description and label stay in admin. The front end receives the rendered widgets.

<?=cmsArea('homepage-hero')?>

cmsArea() accepts the area id or slug and returns HTML. An unknown area returns an empty string.

cmsAreaWithData() renders a widget list you already have, as an array or a JSON string, without loading an area row. The Custom Forms widget uses it for a form's header and footer.

<?=cmsAreaWithData($aWidgetData)?>

Outside production, a widget slug that cannot be resolved throws Nails\Cms\Exception\Widget\NotFoundException. In production that instance is skipped. Disabled widgets are unresolved; hidden widgets still render. See widget constants.

The bundled Area widget embeds one area inside another widget area. Its editor is a dropdown of existing areas (iAreaId).

Widget data is JSON in the widget_data column. The monitor ships a mapper for that column (Nails\Cms\Cms\Monitor\Widget\Area).