CoolCMS API

PreferredCategoryCutTrait

Preferred mode of a category tile list: only root categories with the `preferred` flag (set in admin on the category) are listed, followed by an "All categories" tile that shows the rest.

The mode is opted in by a theme with a render argument; existing calls keep the full list. "All categories" is a plain link with the persistent showAll (a full reload, no snippet), so it needs no render arguments in a signal, unlike the AJAX variant of Bazaar and Comcat.

NOTE: each mount in preferred mode should be its own instance ({multicontrol <name>-<key>:Tile ...}), otherwise two mounts share one showAll.

Table of Contents

Properties

$showAll  : bool
Expands the preferred list to all root categories.

Methods

applyPreferredCut()  : void
Cuts `sortedItems` to the preferred roots and fills `preferredOnly`, `showAll` and `hiddenCount` for the template. Called after the current category context is resolved (it must search the whole tree) and before the rail rows are built from `sortedItems`.

Properties

$showAll

Expands the preferred list to all root categories.

public bool $showAll = false
Attributes
#[Persistent]

Methods

applyPreferredCut()

Cuts `sortedItems` to the preferred roots and fills `preferredOnly`, `showAll` and `hiddenCount` for the template. Called after the current category context is resolved (it must search the whole tree) and before the rail rows are built from `sortedItems`.

protected applyPreferredCut(bool $preferredOnly) : void
Parameters
$preferredOnly : bool
On this page

Search results