OptionsTrait
Table of Contents
Properties
- $countOptions : array<int, int|string>
- $defaults : array<string, mixed>
- $displayModes : array<string, string>
- $labels : array<string, string>
- $orderOptions : array<int, string>
- $viewOptions : array<int, array{icon: string, title: string}>
Methods
- setCountOptions() : self
- setDefaults() : self
- Default parameters on change (e.g. page => 1).
- setDisplayMode() : self
- Sets the display mode for a given parameter.
- setLabels() : self
- setOrderOptions() : self
- setViewOptions() : self
Properties
$countOptions
private
array<int, int|string>
$countOptions
= [0 => 'count.default', 1 => 20, 2 => 50, 3 => 100]
$defaults
private
array<string, mixed>
$defaults
= ['page' => 1]
$displayModes
private
array<string, string>
$displayModes
= ['order' => 'inline', 'view' => 'icons', 'count' => 'select-group']
inline|select|icons|buttons
$labels
private
array<string, string>
$labels
= ['order' => 'order.label', 'count' => 'count.label']
translation keys (relative to $translatorDomain)
$orderOptions
private
array<int, string>
$orderOptions
= [1 => 'order.latest', 2 => 'order.mostRead', 3 => 'order.mostRated']
$viewOptions
private
array<int, array{icon: string, title: string}>
$viewOptions
= [1 => ['icon' => 'fa-solid fa-list', 'title' => 'view.row'], 2 => ['icon' => 'fa-solid fa-grip', 'title' => 'view.box'], 3 => ['icon' => 'fa-solid fa-table-list', 'title' => 'view.table']]
Methods
setCountOptions()
public
setCountOptions(array<int, int> $options) : self
Parameters
- $options : array<int, int>
Return values
selfsetDefaults()
Default parameters on change (e.g. page => 1).
public
setDefaults(array<string, mixed> $defaults) : self
Parameters
- $defaults : array<string, mixed>
Return values
selfsetDisplayMode()
Sets the display mode for a given parameter.
public
setDisplayMode(string $param, string $mode) : self
Parameters
- $param : string
-
order|view|count
- $mode : string
-
inline|select|icons|buttons
Return values
selfsetLabels()
public
setLabels(array<string, string> $labels) : self
Parameters
- $labels : array<string, string>
Return values
selfsetOrderOptions()
public
setOrderOptions(array<int, string> $options) : self
Parameters
- $options : array<int, string>
Return values
selfsetViewOptions()
public
setViewOptions(array<int, array{icon: string, title: string}> $options) : self
Parameters
- $options : array<int, array{icon: string, title: string}>