Contents

Cms\Behaviors\ListComponent

Overview

ListComponent behavior adds record listing capabilities to CMS components.

This behavior provides query building, sorting, pagination, and record exposure for Twig templates. Components supply the base query via listCreateQuery() and the behavior handles the rest.

Usage in a component:

public $implement = [
    \Cms\Behaviors\ListComponent::class,
];

public function listCreateQuery() { return MyModel::query(); }
Extends

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected mixed $primaryRecordCache

Show inherited protected properties

Inherited Protected Properties


Public Methods

public getPrimaryRecord()

public getPrimaryRecord(): void

getPrimaryRecord returns the record(s) with sorting and pagination applied

public getPrimaryRecordQuery()

public getPrimaryRecordQuery(): void

getPrimaryRecordQuery returns the base query, delegating to the component

public getPrimaryRecordResult()

public getPrimaryRecordResult(): void

getPrimaryRecordResult fetches results with sorting and pagination

public listGetPageNumber()

public listGetPageNumber(): string|null 

listGetPageNumber returns the current page number from component properties

public listGetRecordsPerPage()

public listGetRecordsPerPage(): int|null 

listGetRecordsPerPage returns pagination size from component properties

public listGetSortColumn()

public listGetSortColumn(): string|null 

listGetSortColumn returns the sort column from component properties

public listGetSortDirection()

public listGetSortDirection(): string 

listGetSortDirection returns the sort direction from component properties

Show inherited public methods

Inherited Public Methods

Protected Methods

Show inherited protected methods

Inherited Protected Methods