Filter Widget renders a container used for filtering things

  • October\Contracts\Element\FilterElement

Public Properties

public array $scopes

scopes defined by configuration

public Model $model

model associated to the filtering, optional

public string $context

context of this filter, scopes that do not belong to this context will not be shown.

public array|null $extraData

extraData to pass with the filter requests.

public string $customPageName

customPageName will be reset when a filter is applied, shared with the list widget

public array $cssClasses

cssClasses to apply to the filter container element

Show inherited public properties

Inherited Public Properties

Protected Properties

protected $defaultAlias

defaultAlias to identify this widget.

protected boolean $scopesDefined

scopesDefined determines if scope definitions have been created.

protected array $allScopes

allScopes used in this filter.

protected array $scopeModels

scopeModels used in this filter.

protected array $filterWidgets

filterWidgets collection of all filter widgets used in this filter.

protected Backend\Classes\WidgetManager $widgetManager

Show inherited protected properties

Inherited Protected Properties

Public Methods

public addScopes()

public addScopes($scopes): void

addScopes programmatically, used internally and for extensibility.

public applyAllScopesToQuery()

public applyAllScopesToQuery(Builder $query): Builder 

applyAllScopesToQuery applies all scopes to a DB query.

public applyCheckboxScopeToQuery()

public applyCheckboxScopeToQuery($query, $scope): void

public applyDropdownScopeToQuery()

public applyDropdownScopeToQuery($query, $scope): void

public applyScopeToQuery()

public applyScopeToQuery(string $scope, Builder $query): Builder 

applyScopeToQuery applies a filter scope constraints to a DB query.

public applyWidgetScopeToQuery()

public applyWidgetScopeToQuery($query, $scope): void

public bindToController()

public bindToController(): void 

bindToController ensures scopes are defined and filter widgets are registered so they can also be bound to the controller this allows their AJAX features to operate.

public defineScope()

public defineScope(
    $scopeName = null,
    $label = null
): October\Rain\Element\Filter\ScopeDefinition 

defineScope adds a scope to the filter element

public extendScopeModelQuery()

public extendScopeModelQuery($scope, $query): void

public extendScopeUpdateResponse()

public extendScopeUpdateResponse($result, $params): void

public getContext()

public getContext(): string 

getContext returns the active context for displaying the form.

public getFilterWidget()

public getFilterWidget(string $scope): void

getFilterWidget returns a specified filter widget

public getFilterWidgets()

public getFilterWidgets(): array 

getFilterWidgets for the instance

public getHeaderValue()

public getHeaderValue($scope): void

getHeaderValue looks up the scope header

public getModel()

public getModel(): Model|null 

getModel returns the active model for this form.

public getScope()

public getScope(string $scope): mixed 

getScope gets a specified scope object

public getScopeValue()

public getScopeValue($scope): void

getScopeValue returns a scope value for this widget instance.

public getScopes()

public getScopes(): array 

getScopes gets all the registered scopes for the instance.

public init()

public init(): void

init the widget, called by the constructor and free from its parameters.

public makeFilterWidget()

public makeFilterWidget(
    string $class,
    mixed $scopeConfig = [],
    array $widgetConfig = []
): Backend\Classes\FilterWidgetBase 

makeFilterWidget object with the supplied filter scope and widget configuration.

public nameToId()

public nameToId($input $input): string 

nameToId is a helper method to convert a field name to a valid ID attribute

public onFilterClearAll()

public onFilterClearAll(): void

public onFilterUpdate()

public onFilterUpdate(): array 

onFilterUpdate updates a filter scope value.

public onLoadFilterForm()

public onLoadFilterForm(): void

public onPreloadContent()

public onPreloadContent(): void

public prepareVars()

public prepareVars(): void

prepareVars for display

public putScopeValue()

public putScopeValue($scope, $value): void

putScopeValue sets an scope value for this widget instance.

public removeScope()

public removeScope(string $scopeName): void

removeScope programmatically, used for extensibility.

public render()

public render(): void

render the widget.

public renderScopeElement()

public renderScopeElement($scope): void

renderScopeElement for a scope

public renderScopeFormElement()

public renderScopeFormElement($scope): void

public setScopeValue()

public setScopeValue($scope, $value): void

Show inherited public methods

Inherited Public Methods

Protected Methods

protected addScopesFromModel()

protected addScopesFromModel(): void 

addScopesFromModel from the model

protected applyFiltersFromModel()

protected applyFiltersFromModel(): void

applyFiltersFromModel allows the model to filter scopes

protected defineFilterScopes()

protected defineFilterScopes(): void

defineFilterScopes creates an array of filter scopes from the configuration

protected evalScopeName()

protected evalScopeName($scope): array 

evalScopeName parses a scopes's name for embedded context with a result of scopeName@context to [scopeName, context]

protected getDependScopes()

protected getDependScopes($parentScope): array 

protected initFilterWidgetsConcern()

protected initFilterWidgetsConcern(): void

protected isFilterWidget()

protected isFilterWidget($scopeType): bool 

isFilterWidget checks if a field type is a widget or not

protected loadAssets()

protected loadAssets(): void

loadAssets adds widget specific asset files. Use $this->addJs() and $this->addCss() to register new assets to include on the page.

protected makeFilterScope()

protected makeFilterScope($name, $config): void

makeFilterScope creates a filter scope object from name and configuration.

protected makeFilterScopeWidget()

protected makeFilterScopeWidget($scope): Backend\Classes\FilterWidgetBase|null 

makeFilterScopeWidget object from a filter field object

protected makeNestedFilterModel()

protected makeNestedFilterModel($model, $field): void

makeNestedFilterModel resolves a relation based on a nested field name E.g: model[relation1][relation2] → $model->relation1()->relation2()

protected processFieldOptionValues()

protected processFieldOptionValues($scopes): void 

processFieldOptionValues sets the callback for retrieving options

protected processFilterWidgetScopes()

protected processFilterWidgetScopes($scopes): void 

processFilterWidgetScopes will mutate scopes types that are registered as widgets, convert their type to 'widget' and internally allocate the widget object

protected processLegacyDefinitions()

protected processLegacyDefinitions($scopes): void 

processLegacyDefinitions applies deprecated definitions for backwards compatibility

protected processPermissionCheck()

protected processPermissionCheck($scopes): void 

processPermissionCheck check if user has permissions to show the scope and removes it if permission is denied

protected processScopeModels()

protected processScopeModels($scopes): void 

processScopeModels creates associated models for scopes

protected refitLegacyClearScope()

protected refitLegacyClearScope($scope): void

protected refitLegacyDateParse()

protected refitLegacyDateParse($value): void

protected refitLegacyDateRangeScope()

protected refitLegacyDateRangeScope($scope): void

protected refitLegacyDateScope()

protected refitLegacyDateScope($scope): void

protected refitLegacyDefaultScope()

protected refitLegacyDefaultScope($scope): void

protected refitLegacyNumberRangeScope()

protected refitLegacyNumberRangeScope($scope): void

protected refitLegacyNumberScope()

protected refitLegacyNumberScope($scope): void

protected refitLegacyTextScope()

protected refitLegacyTextScope($scope): void

Show inherited protected methods

Inherited Protected Methods