Since: 4.0.0

trait CategoryServiceTrait

Trait for component categories service.

Methods

getCategory(array $options = [], string $section = '')

Returns the category service.

void
setCategoryFactory(CategoryFactoryInterface $categoryFactory)

Sets the internal category factory.

void
countItems(array $items, string $section)

Adds Count Items for Category Manager.

void
prepareForm(Form $form, array|object $data)

Prepares the category form

string|null
getTableNameForSection(string|null $section = null)

Returns the table for the count items functions for the given section.

string|null
getStateColumnForSection(string|null $section = null)

Returns the state column for the count items functions for the given section.

Details

CategoryInterface getCategory(array $options = [], string $section = '')

Since: 4.0.0

Returns the category service.

Parameters

array $options

The options

string $section

The section

Return Value

CategoryInterface

Exceptions

SectionNotFoundException

void setCategoryFactory(CategoryFactoryInterface $categoryFactory)

Since: 4.0.0

Sets the internal category factory.

Parameters

CategoryFactoryInterface $categoryFactory

The categories factory

Return Value

void

void countItems(array $items, string $section)

Since: 4.0.0

Adds Count Items for Category Manager.

Parameters

array $items

The category objects

string $section

The section

Return Value

void

Exceptions

Exception

void prepareForm(Form $form, array|object $data)

Prepares the category form

Parameters

Form $form

The form to change

array|object $data

The form data

Return Value

void

protected string|null getTableNameForSection(string|null $section = null)

Since: 4.0.0

Returns the table for the count items functions for the given section.

Parameters

string|null $section

The section

Return Value

string|null

protected string|null getStateColumnForSection(string|null $section = null)

Since: 4.0.0

Returns the state column for the count items functions for the given section.

Parameters

string|null $section

The section

Return Value

string|null