FacetedCategory
abstract class FacetedCategory implements ItemListInterface, ItemInterface
Traits
Constants
| DISPLAY_TYPE_CHECKBOX |
|
| DISPLAY_TYPE_TEXT |
|
| DISPLAY_TYPE_DATE |
|
| DISPLAY_TYPE_TOGGLE |
|
Properties
| protected FacetedFilter | $faceted | ||
| protected I18nTokenHelper | $label | ||
| protected array | $defaultValues | ||
| protected bool | $hasMoreItems | ||
| protected bool | $showEmptyItems | ||
| protected bool | $showInMoreOnly | ||
| protected bool | $showItemCount | ||
| protected Closure|string|null | $callback |
Methods
Constructor
No description
Adds a default value for this category.
Extended class has to add the scope condition for its category based on the $active (aka selected) values
Extended class has to auto build its FacetedCategoryItems.
Returns items of this category, which are active
getter
Extended class has to return one of the display types defined via constant in this class!
No description
No description
No description
No description
No description
No description
Returns the options array used mainly by the vue component
Getter for showInMoreOnly
No description
Does category have a callback?
Are FacetedCategoryItems defined?
No description
No description
Sets items to active based on the given $values
Set the default value(s) for this category
Use setDefaultValues() to set the default values.
No description
No description
No description
If enabled, the category will also show items with a hit count of 0
If enabled, the category will only be shown in the "more filters" section
No description
Sorts the category items by hit count (descending)
Details
at line 368
protected
__construct()
Constructor
at line 372
string
__toString()
No description
at line 197
FacetedCategory
addDefaultValue(string $defaultValue)
Adds a default value for this category.
at line 64
abstract Collection
addScopeCondition(Collection $collection, array $active)
Extended class has to add the scope condition for its category based on the $active (aka selected) values
at line 54
abstract void
autoBuildItems(Collection $collection, int $limit, string $query = '')
Extended class has to auto build its FacetedCategoryItems.
in
ItemListTrait at line 147
int
count()
No description
in
ItemListTrait at line 37
static ItemListTrait
create(ItemInterface ...$items)
No description
at line 37
abstract static FacetedCategory
createCategory(FacetedFilter $faceted, I18nTokenHelper $label)
Class to create the category
in
ItemListTrait at line 96
ItemInterface|null
first()
Get first element
at line 308
array
getActiveItems()
Returns items of this category, which are active
at line 218
array
getDefaultValues()
getter
at line 43
abstract string
getDisplayType()
Extended class has to return one of the display types defined via constant in this class!
at line 115
bool
getHasMoreItems()
No description
at line 122
string
getIconClass()
No description
at line 20
FacetedCategoryItem[]
getItems()
No description
at line 20
FacetedCategoryItem[]
getIterator()
No description
at line 361
string
getKey()
No description
at line 103
I18nTokenHelper
getLabel()
No description
at line 226
array
getOptions()
Returns the options array used mainly by the vue component
at line 187
bool
getShowInMoreOnly()
Getter for showInMoreOnly
at line 418
bool
getShowItemCount()
No description
at line 398
bool
hasCallback()
Does category have a callback?
at line 111
bool
hasItems()
Are FacetedCategoryItems defined?
at line 408
void
invokeCallBack(Collection $collection, array $selectedCategoryValues = [])
No description
at line 142
bool
isRequired()
No description
in
ItemListTrait at line 154
array
jsonSerialize()
No description
in
ItemListTrait at line 88
ItemInterface|null
last()
Return the last element
in
ItemListTrait at line 116
bool
offsetExists($offset)
No description
at line 20
FacetedCategoryItem
offsetGet(mixed $offset)
No description
in
ItemListTrait at line 133
void
offsetSet($offset, $value)
No description
in
ItemListTrait at line 140
void
offsetUnset($offset)
No description
at line 337
int
push(ItemInterface $item)
No description
at line 325
FacetedCategory
pushItem(FacetedCategoryItem $item)
Adds an item to the ItemList
at line 240
FacetedCategory
setActive(array $values)
Sets items to active based on the given $values
at line 389
FacetedCategory
setCallback(Closure $callback)
Sets the callback to filter the $collection
at line 209
FacetedCategory
setDefaultValues(array $defaultValues)
Set the default value(s) for this category
at line 262
void
setDefaults()
Use setDefaultValues() to set the default values.
Calls the setDefault() and setActive() methods for items that are default values. (if the category has no active item)
at line 132
FacetedCategory
setIconClass(string $iconClass)
No description
in
ItemListTrait at line 66
void
setItems(array $items)
No description
at line 350
FacetedCategory
setKey(string $key)
No description
at line 152
FacetedCategory
setRequired(bool $required)
No description
at line 166
FacetedCategory
setShowEmptyItems(bool $show = true)
If enabled, the category will also show items with a hit count of 0
at line 178
FacetedCategory
setShowInMoreOnly(bool $show = true)
If enabled, the category will only be shown in the "more filters" section
at line 422
FacetedCategory
setShowItemCount(bool $showItemCount = true)
No description
at line 295
protected void
sortItems()
Sorts the category items by hit count (descending)
in
ItemListTrait at line 74
array
toArray()
Transforms the option into an array.
in
ItemListTrait at line 49
int
unshift(ItemInterface $item)
No description