> $items * @param array{title: string, description?: ?string, icon?: ?string}|null $emptyState * @param array $viewData */ public function __construct( public string $kind, public string $title, public array $items = [], public bool $visible = true, public ?PageActionData $action = null, public ?string $description = null, public ?string $view = null, public array $viewData = [], public ?array $emptyState = null, ) {} public function shouldRender(): bool { if (! $this->visible || trim($this->title) === '') { return false; } return $this->items !== [] || $this->view !== null || $this->emptyState !== null; } /** * @return array{ * kind: string, * title: string, * items: list>, * visible: bool, * action: array{label: string, placement: string, url: ?string, actionName: ?string, destructive: bool, requiresConfirmation: bool, visible: bool, icon: ?string, openInNewTab: bool}|null, * description: ?string, * view: ?string, * viewData: array, * emptyState: array{title: string, description?: ?string, icon?: ?string}|null * } */ public function toArray(): array { return [ 'kind' => $this->kind, 'title' => $this->title, 'items' => array_values($this->items), 'visible' => $this->visible, 'action' => $this->action?->isRenderable() === true ? $this->action->toArray() : null, 'description' => $this->description, 'view' => $this->view, 'viewData' => $this->viewData, 'emptyState' => $this->emptyState, ]; } }