CoolCMS API

CategorySuggestItem
in package

FinalYes

Single category suggestion item. Plain data: it crosses the bridge as an array ({@see toArray()} / {@see fromArray()}) because `Result::data` must not carry an entity.

  • name is the category name (the text put into the field after selection),
  • path holds the ancestor names from the root ("Cars › Passenger cars") and is the second line of the item.

Table of Contents

Properties

$categoryId  : int
$level  : int
$name  : string
$path  : string

Methods

__construct()  : mixed
fromArray()  : self|null
toArray()  : array{categoryId: int, name: string, path: string, level: int}
toPickerArray()  : array{id: int, label: string, name: string, meta: string}
Returns the shape consumed by the `picker.js` client: `name` + `meta` (two-line item), `label` for screen readers and the legacy contract.
str()  : string

Properties

Methods

__construct()

public __construct(int $categoryId, string $name, string $path, int $level) : mixed
Parameters
$categoryId : int
$name : string
$path : string
$level : int

fromArray()

public static fromArray(array<string, mixed> $row) : self|null
Parameters
$row : array<string, mixed>
Return values
self|null

toArray()

public toArray() : array{categoryId: int, name: string, path: string, level: int}
Return values
array{categoryId: int, name: string, path: string, level: int}

toPickerArray()

Returns the shape consumed by the `picker.js` client: `name` + `meta` (two-line item), `label` for screen readers and the legacy contract.

public toPickerArray() : array{id: int, label: string, name: string, meta: string}
Return values
array{id: int, label: string, name: string, meta: string}

str()

private static str(mixed $value) : string
Parameters
$value : mixed
Return values
string
On this page

Search results