PHP Class MetaModels\Filter\Setting\Simple

Inheritance: implements MetaModels\Filter\Setting\ISimple
显示文件 Open project: metamodels/core

Public Methods

Method Description
__construct ( MetaModels\Filter\Setting\ICollection $collection, array $data ) Constructor - initialize the object and store the parameters.
generateFilterUrlFrom ( MetaModels\IItem $objItem, MetaModels\Render\Setting\ICollection $objRenderSetting )
get ( $strKey )
getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface Retrieve the event dispatcher.
getFilterSettings ( ) : MetaModels\Filter\Setting\ICollection Get the parenting collection instance.
getMetaModel ( ) : MetaModels\IMetaModel Return the MetaModel instance this filter setting relates to.
getParameterDCA ( )
getParameterFilterNames ( )
getParameterFilterWidgets ( $arrIds, $arrFilterUrl, $arrJumpTo, MetaModels\FrontendIntegration\FrontendFilterOptions $objFrontendFilterOptions )
getParameters ( )
getReferencedAttributes ( )
getServiceContainer ( ) : MetaModels\IMetaModelsServiceContainer Retrieve the service container.

Protected Methods

Method Description
addUrlParameter ( string $url, string $name, mixed $value ) : string. Add a parameter to the url, if it is auto_item, it will get prepended.
buildFilterUrl ( array $fragments, string $searchKey ) : string Build the filter url based upon the fragments.
getFrontendFilterValue ( array $arrWidget, array $arrFilterUrl, string $strKeyOption ) : string Translate an option to a proper url value to be used in the filter url.
isActiveFrontendFilterValue ( array $arrWidget, array $arrFilterUrl, string $strKeyOption ) : boolean Returns if the given value is currently active in the given filter settings.
prepareFrontendFilterOptions ( array $arrWidget, array $arrFilterUrl, array $arrJumpTo, boolean $blnAutoSubmit ) : array Generate the options for the frontend widget as the frontend templates expect them.
prepareFrontendFilterWidget ( array $arrWidget, array $arrFilterUrl, array $arrJumpTo, MetaModels\FrontendIntegration\FrontendFilterOptions $objFrontendFilterOptions ) : array Returns the frontend filter widget information for the filter setting.
validateWidget ( Widget $widget, string | null $value ) : void Validate the widget using the value.

Method Details

__construct() public method

Constructor - initialize the object and store the parameters.
public __construct ( MetaModels\Filter\Setting\ICollection $collection, array $data )
$collection MetaModels\Filter\Setting\ICollection The parenting filter settings object.
$data array The attributes for this filter setting.

addUrlParameter() protected method

Add a parameter to the url, if it is auto_item, it will get prepended.
protected addUrlParameter ( string $url, string $name, mixed $value ) : string.
$url string The url built so far.
$name string The parameter name.
$value mixed The parameter value.
return string.

buildFilterUrl() protected method

Build the filter url based upon the fragments.
protected buildFilterUrl ( array $fragments, string $searchKey ) : string
$fragments array The parameters to be used in the Url.
$searchKey string The param key to handle for "this".
return string

generateFilterUrlFrom() public method

public generateFilterUrlFrom ( MetaModels\IItem $objItem, MetaModels\Render\Setting\ICollection $objRenderSetting )
$objItem MetaModels\IItem
$objRenderSetting MetaModels\Render\Setting\ICollection

get() public method

public get ( $strKey )

getEventDispatcher() public method

Retrieve the event dispatcher.
public getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
return Symfony\Component\EventDispatcher\EventDispatcherInterface

getFilterSettings() public method

Get the parenting collection instance.
public getFilterSettings ( ) : MetaModels\Filter\Setting\ICollection
return MetaModels\Filter\Setting\ICollection The parent.

getFrontendFilterValue() protected method

Overriding this method allows to toggle the value in the url in addition to extract or inject a value into an "combined" filter url parameter (like tags i.e.)
protected getFrontendFilterValue ( array $arrWidget, array $arrFilterUrl, string $strKeyOption ) : string
$arrWidget array The widget information.
$arrFilterUrl array The filter url parameters to use.
$strKeyOption string The option value to determine.
return string The filter url value to use for link gererating.

getMetaModel() public method

Return the MetaModel instance this filter setting relates to.
public getMetaModel ( ) : MetaModels\IMetaModel
return MetaModels\IMetaModel

getParameterDCA() public method

public getParameterDCA ( )

getParameterFilterNames() public method

getParameterFilterWidgets() public method

public getParameterFilterWidgets ( $arrIds, $arrFilterUrl, $arrJumpTo, MetaModels\FrontendIntegration\FrontendFilterOptions $objFrontendFilterOptions )
$objFrontendFilterOptions MetaModels\FrontendIntegration\FrontendFilterOptions

getParameters() public method

public getParameters ( )

getReferencedAttributes() public method

getServiceContainer() public method

Retrieve the service container.
public getServiceContainer ( ) : MetaModels\IMetaModelsServiceContainer
return MetaModels\IMetaModelsServiceContainer

isActiveFrontendFilterValue() protected method

Returns if the given value is currently active in the given filter settings.
protected isActiveFrontendFilterValue ( array $arrWidget, array $arrFilterUrl, string $strKeyOption ) : boolean
$arrWidget array The widget information.
$arrFilterUrl array The filter url parameters to use.
$strKeyOption string The option value to determine.
return boolean true If the given value is mentioned in the given filter parameters, false otherwise.

prepareFrontendFilterOptions() protected method

The returning array will be made of option arrays containing the following fields: * key The option value as raw key from the options array in the given widget information. * value The value to show as option label. * href The URL to use to activate this value in the filter. * active Boolean determining if this value is the current active option in the widget. * class The CSS class to use. Contains active if the option is active or is empty otherwise.
protected prepareFrontendFilterOptions ( array $arrWidget, array $arrFilterUrl, array $arrJumpTo, boolean $blnAutoSubmit ) : array
$arrWidget array The widget information to use for value generating.
$arrFilterUrl array The filter url parameters to use.
$arrJumpTo array The jumpTo page to use for URL generating - if empty, the current frontend page will get used.
$blnAutoSubmit boolean Determines if the generated options/widgets shall perform auto submitting or not.
return array The filter option values to use in the mm_filteritem_* templates.

prepareFrontendFilterWidget() protected method

The returning array will hold the following keys: * class - The CSS classes for the widget. * label - The label text for the widget. * formfield - The parsed default widget object for this filter setting. * raw - The widget information that was used for rendering "formfield" as raw array (this means prior calling prepareForWidget()). * urlparam - The URL parameter used for this widget. * options - The filter options available to be used in selects etc. see prepareFrontendFilterOptions for details on the contained array. * autosubmit - True if the frontend filter shall perform auto form submitting, false otherwise. * urlvalue - The current value selected in the filtersetting. Will use "urlvalue" from $arrWidget with fallback to the value of the url param in the filter url.
protected prepareFrontendFilterWidget ( array $arrWidget, array $arrFilterUrl, array $arrJumpTo, MetaModels\FrontendIntegration\FrontendFilterOptions $objFrontendFilterOptions ) : array
$arrWidget array The widget information to use for generating.
$arrFilterUrl array The filter url parameters to use.
$arrJumpTo array The jumpTo page to use for URL generating - if empty, the current frontend page will get used.
$objFrontendFilterOptions MetaModels\FrontendIntegration\FrontendFilterOptions The options to use.
return array

validateWidget() protected method

Validate the widget using the value.
protected validateWidget ( Widget $widget, string | null $value ) : void
$widget Contao\Widget The widget to validate.
$value string | null The value to validate.
return void