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
- $extendableStaticCalledClass - is the calling class when using a static method. (defined in October\Rain\Extension\ExtensionBase)
Protected Properties
protected mixed $primaryRecordCache
Show inherited protected properties
Inherited Protected Properties
- $component - class. (defined in Cms\Classes\ComponentBehavior)
- $controller - to CMS controller. (defined in Cms\Classes\ComponentBehavior)
- $requiredProperties - that must exist in the component using this behavior. (defined in Cms\Classes\ComponentBehavior)
- $extensionHidden - are properties and methods that cannot be accessed. (defined in October\Rain\Extension\ExtensionBase)
- $configPath - specifies a path to the config directory. (defined in Cms\Classes\ComponentBehavior)
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
Inherited Public Methods
- __construct() - the behavior. (defined in Cms\Classes\ComponentBehavior)
- beforeDisplay() - fires before the page is displayed and AJAX is executed. (defined in Cms\Classes\ComponentBehavior)
- extend() - this class with a closure. (defined in October\Rain\Extension\ExtensionBase)
- extensionApplyInitCallbacks() - (defined in October\Rain\Extension\ExtensionBase)
- extensionExtendCallback() - is a helper method for
::extend()static method. (defined in October\Rain\Extension\ExtensionBase) - extensionIsHiddenMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionIsHiddenProperty() - (defined in October\Rain\Extension\ExtensionBase)
- getCalledExtensionClass() - (defined in October\Rain\Extension\ExtensionBase)
- getConfigPath() - locates a file based on it's definition. If the file starts with. (defined in Cms\Classes\ComponentBehavior)
- guessConfigPath() - guesses the package path for the called class. (defined in Cms\Classes\ComponentBehavior)
- guessConfigPathFrom() - guesses the package path from a specified class. (defined in Cms\Classes\ComponentBehavior)
- makeConfig() - reads the contents of the supplied file and applies it to this object. (defined in Cms\Classes\ComponentBehavior)
- makeConfigFromArray() - makes a config object from an array, making the first. (defined in Cms\Classes\ComponentBehavior)
- mergeConfig() - merges two configuration sources, either prepared or not, and returns. (defined in Cms\Classes\ComponentBehavior)
Protected Methods
Show inherited protected methods
Inherited Protected Methods
- extensionHideMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionHideProperty() - (defined in October\Rain\Extension\ExtensionBase)
- getConfigValueFrom() - will apply the config getter convention. (defined in Cms\Classes\ComponentBehavior)