Skip to content

pbFilters

Renders a ready-made filter form for a constructor table. The fields come from the table definition, so the form follows the constructor instead of being written by hand.

[[!pbFilters? &table=`Products`]]

Parameters

ParameterDefaultDescription
tableRequired. Table name as it is called in the constructor.
namespaceNamespace of the component owning the table, when it is not pageblocks.

An empty table renders nothing rather than erroring.

Which fields appear

Only the fields marked filterable in the constructor. That flag is per field, so the form is controlled from the same place as the table itself — adding a filter does not require touching the template.

Example

html
<aside class="filters">
    [[!pbFilters? &table=`Products`]]
</aside>

<div class="results">
    [[!pbList? &model=`PbProduct` &tpl=`chunk:productCard` &limit=`12`]]
</div>

From Fenom

php
{pb_filters(table='Products')}

Tables belonging to satellite components

pbShop and other satellites keep their tables in the same pb_tables, told apart by namespace. If a table is not found, pass its namespace explicitly.

© PageBlocks 2019-present