PHP Class MetaModels\Attribute\Base

To create a MetaModelAttribute instance, use the {@link MetaModelAttributeFactory} This class is the reference implementation for {@link IMetaModelAttribute}.
Inheritance: implements MetaModels\Attribute\IAttribute
Show file Open project: metamodels/core Class Usage Examples

Protected Properties

Property Type Description
$arrData array The meta information of this attribute.

Public Methods

Method Description
__construct ( MetaModels\IMetaModel $objMetaModel, array $arrData = [] ) Instantiate an MetaModel attribute.
destroyAUX ( )
filterGreaterThan ( $varValue, $blnInclusive = false )
filterLessThan ( $varValue, $blnInclusive = false )
filterNotEqual ( $varValue ) {@inheritdoc} Base implementation, merge the result of filterLessThan() and filterGreaterThan().
get ( $strKey )
getAttributeSettingNames ( )
getColName ( )
getDefaultRenderSettings ( )
getFieldDefinition ( $arrOverrides = [] )
getFilterUrlValue ( $varValue )
getItemDCA ( $arrOverrides = [] )
getMetaModel ( )
getName ( ) : string Retrieve the human readable name (or title) from the attribute.
handleMetaChange ( $strMetaName, $varNewValue )
hookAdditionalFormatters ( array $arrBaseFormatted, array $arrRowData, string $strOutputFormat, MetaModels\Render\Setting\ISimple $objSettings ) : mixed Hook additional attribute formatter that want to format the value.
initializeAUX ( )
modelSaved ( $objItem ) {@inheritdoc} Base implementation, do not perform anything.
parseValue ( $arrRowData, $strOutputFormat = 'text', $objSettings = null )
searchFor ( $strPattern ) {@inheritdoc} Base implementation, do not perform any search;
set ( $strKey, $varValue )
sortIds ( $idList, $strDirection )
valueToWidget ( $varValue )
widgetToValue ( $varValue, $itemId )

Protected Methods

Method Description
getLangValue ( array $arrValues, string $strLangCode = null ) : mixed | null This extracts the value for the given language from the given language array.
getOverrideValue ( string $name, array $overrides ) : mixed Extract an override value.
parameterMask ( array $parameters ) : string Helper method for generating a list of "?" to be used in a Contao query.
prepareTemplate ( MetaModels\Render\Template $objTemplate, array $arrRowData, MetaModels\Render\Setting\ISimple $objSettings ) : void When rendered via a template, this populates the template with values.

Private Methods

Method Description
getBaseDefinition ( ) : array Retrieve the base definition by the user from dca_config.
isAllowedValue ( string $name ) : boolean Check if a value may be overridden.
setBaseEval ( array $fieldDefinition, array $overrides ) : array Extract an override value.
setLanguageStrings ( ) : void Set the language strings.

Method Details

__construct() public method

Note that you should not use this directly but use the factory classes to instantiate attributes.
public __construct ( MetaModels\IMetaModel $objMetaModel, array $arrData = [] )
$objMetaModel MetaModels\IMetaModel The MetaModel instance this attribute belongs to.
$arrData array The information array, for attribute information, refer to documentation of table tl_metamodel_attribute and documentation of the certain attribute classes for information what values are understood.

destroyAUX() public method

public destroyAUX ( )

filterGreaterThan() public method

Base implementation, return empty array.
public filterGreaterThan ( $varValue, $blnInclusive = false )

filterLessThan() public method

Base implementation, return empty array.
public filterLessThan ( $varValue, $blnInclusive = false )

filterNotEqual() public method

{@inheritdoc} Base implementation, merge the result of filterLessThan() and filterGreaterThan().
public filterNotEqual ( $varValue )

get() public method

public get ( $strKey )

getAttributeSettingNames() public method

getColName() public method

public getColName ( )

getDefaultRenderSettings() public method

getFieldDefinition() public method

public getFieldDefinition ( $arrOverrides = [] )

getFilterUrlValue() public method

This base implementation returns the value itself.
public getFilterUrlValue ( $varValue )

getItemDCA() public method

Deprecation: Use DataDefinition builders in DC_General 2.0.0
public getItemDCA ( $arrOverrides = [] )

getLangValue() protected method

If the language is not contained within the value array, the fallback language from the parenting {@link IMetaModel} instance is tried as well.
protected getLangValue ( array $arrValues, string $strLangCode = null ) : mixed | null
$arrValues array The array holding all language values in the form array('langcode' => $varValue).
$strLangCode string The language code of the language to fetch. Optional, if not given, $GLOBALS['TL_LANGUAGE'] is used.
return mixed | null the value for the given language or the fallback language, NULL if neither is present.

getMetaModel() public method

public getMetaModel ( )

getName() public method

If the MetaModel is translated, the currently active language is used, with properly falling back to the defined fallback language.
public getName ( ) : string
return string the human readable name

getOverrideValue() protected method

Extract an override value.
protected getOverrideValue ( string $name, array $overrides ) : mixed
$name string The name of the value.
$overrides array The overrides containing the values to be overridden.
return mixed

handleMetaChange() public method

public handleMetaChange ( $strMetaName, $varNewValue )

hookAdditionalFormatters() public method

Hook additional attribute formatter that want to format the value.
public hookAdditionalFormatters ( array $arrBaseFormatted, array $arrRowData, string $strOutputFormat, MetaModels\Render\Setting\ISimple $objSettings ) : mixed
$arrBaseFormatted array The current result array. The keys "raw" and "text" are always populated.
$arrRowData array The Raw values from the database.
$strOutputFormat string The output format to use.
$objSettings MetaModels\Render\Setting\ISimple The output format settings.
return mixed

initializeAUX() public method

public initializeAUX ( )

modelSaved() public method

{@inheritdoc} Base implementation, do not perform anything.
public modelSaved ( $objItem )

parameterMask() protected method

Usage: $params = array('1', '2', 'potential SQL injection string'); $result = $database ->prepare('SELECT * FROM tl_something WHERE id IN (' . $this->parameterMask($params) . ')') ->execute($params);
protected parameterMask ( array $parameters ) : string
$parameters array The parameters to be used in a query.
return string

parseValue() public method

public parseValue ( $arrRowData, $strOutputFormat = 'text', $objSettings = null )

prepareTemplate() protected method

When rendered via a template, this populates the template with values.
protected prepareTemplate ( MetaModels\Render\Template $objTemplate, array $arrRowData, MetaModels\Render\Setting\ISimple $objSettings ) : void
$objTemplate MetaModels\Render\Template The Template instance to populate.
$arrRowData array The row data for the current item.
$objSettings MetaModels\Render\Setting\ISimple The render settings to use for this attribute.
return void

searchFor() public method

{@inheritdoc} Base implementation, do not perform any search;
public searchFor ( $strPattern )

set() public method

public set ( $strKey, $varValue )

sortIds() public method

public sortIds ( $idList, $strDirection )

valueToWidget() public method

public valueToWidget ( $varValue )

widgetToValue() public method

public widgetToValue ( $varValue, $itemId )

Property Details

$arrData protected property

The meta information of this attribute.
protected array $arrData
return array