Configuration
Everything in Settings → Legs can also live in config/legs.php, where it is version-controlled and per-environment.
<?php
return [
'registerCss' => true, // Legs' stylesheet, when a table renders
'registerJs' => true, // the runtime, when a table needs one
'allowHtmlInCells' => true, // purified on save and on render
'purifierConfig' => null, // a file in config/htmlpurifier/, without the extension
'defaultOptions' => [], // render options handed to every new table
'refreshOnElementSave' => true, // rebuild query tables when a matching element is saved
'refreshInterval' => 3600,
];
Front-end assets
registerCss and registerJs decide whether Legs adds its own stylesheet and runtime when a table renders. Both are loaded only when needed: no table on the page means neither, and a table with no sorting, search or pagination loads no JavaScript.
Turn registerCss off if you style tables yourself. The markup and the runtime work without it.
Cell content
allowHtmlInCells on (the default) means a cell may hold a link or bold text, purified on save and again on render. Off, a cell that looks like markup is shown as text.
purifierConfig names a JSON file in config/htmlpurifier/ — the same files Craft's own rich-text fields use — without the extension. Table cells are a rich-text surface like any other, and get the same treatment.
Defaults for new tables
defaultOptions is a render-options array handed to every table created from then on. Useful when a site's house style is, say, compact and unstriped:
'defaultOptions' => [
'compact' => true,
'striped' => false,
'responsive' => 'stack',
],
It is a default, not a policy: existing tables keep what they have, and an author can change theirs.
Query tables
refreshOnElementSave decides whether saving an element queues a rebuild of the query tables that could contain it. Turn it off if you would rather rebuild on a schedule — see console commands.
Environment overrides
The file is a normal Craft config file, so multi-environment arrays work as usual:
return [
'*' => [
'allowHtmlInCells' => true,
],
'production' => [
'refreshOnElementSave' => false, // rebuilt by cron instead
],
];
Anything set in the file wins over the control panel, and the control panel shows it as read-only, exactly as Craft does elsewhere.