Item properties
$cacheProviderName
The name of the cache provider to use.
Default: engine
$cacheTtl
The TTL for the cache storage.
Default: CACHE_TTL_NORMAL
$cacheSpecificPrefix
The string to use as the key for this Item in the cache, the value of the idFieldName will be appended.
$databaseProvider
The name of the database provider to use when querying the database for this item.
Default: main
$fields
Hash array specification of the fields on the database table for this item class, where each key is the field name and the value is a hash array with the following keys:
typeThe type of the field, one of the availableDATABASE_FIELD_TYPE_?formItemA hash array containing the specification of this field when used in forms. Used by ItemAdmin.typeThe type of the form item, one of the availableFORM_ITEM_TYPE_?selectTypeWhen using theFORM_ITEM_TYPE_SELECTtype, the select type, from one of the following available values:FORM_ITEM_SELECT_TYPE_RADIOSFORM_ITEM_SELECT_TYPE_COMBO
itemsWhen using theFORM_ITEM_TYPE_SELECTtype, a hash array of the items available to be selected, where each key is the field value, and each value is a hash array with the following possible keys:titleThe title of the select optionsubTitleThe subtitle of the select option
isMultiLanguageWhether this field stores multi-language data, meaning there are more than one actual fields on the database, one for each available language. As configured in the Locale module's setup keyavailableLanguagestitleThe title of the field, to be used when representing data on UI components like UiComponentTableAdmin.prefixThe prefix string to add when humanizing the field value. For example:USDfor american dollar quantities likeUSD300postfixThe postfix string to add when humanizing the field value. For example:ºfor values in degrees like32ºmultiplierA multiplier to apply when humanizing the field value.decimalsThe number of decimals to show when humanizing the field valuehumanizeMethodNameA method name to call to humanize the field value. It will receive the Item object as the first and only parameter. If this returns something other than null, the returned value will be used and any other humanizing method and configs likeprefix,postfix,multiplier,decimals, etc will be omitted.humanizePreMethodNameA method name to call with the field value before any other humanization is done. It will receive the Item object as the first and only parameter.humanizePostMethodNameA method name to call with the field value after any other humanization is done. It will receive the already treated value as the first parameter and the Item object as the second.requestSecurityRulesAn array of security rules from the availableSECURITY_RULE_?that should be applied whenever receiving values for this field in a request, just like the RequestParameter class accepts. Used for example in ItemAdmin.requestFiltersAn array of filter from the availableSECURITY_FILTER_?that should be applied whenever receiving values for this field in a request, just like the RequestParameter class accepts. Used for example in ItemAdmin.validationMethodAn anonymous function to validate the received value for this field, or an array where the first element is the class name, and the second the method name, just like thecall_user_funcPHP function would expect it. Must return an AjaxResponseJson object. Used for example in ItemAdmin.
$idFieldName
The name of the field on the table that uniquely identifies this item on the database table with a numeric id. It should be an auto-increment field.
Default: id
$loadFromIdMethod
The method to use when loading this item from the database via an index. Possible values:
queryDatabaseCacheLoad the item from the database using cache.queryDatabaseLoad the item from the database without using cache.
Default: queryDatabase
$metaFields
Hash array specification of the fields for this item type that are not fields on the database, but instead fields that interact with the database in a special way. For example, a location meta field might interact with the database by setting the countryId, regionId and cityId non-meta fields. Each key is the field name, and each value a hash array with following possible keys:
formItemA hash array containing the specification of this field for forms, used by ItemAdmin, just like theformItemkey in thefieldsproperty.typeThe type of the form item, one of the availableFORM_ITEM_META_TYPE_?levelsForFORM_ITEM_META_TYPE_MULTILEVEL_SELECTorFORM_ITEM_META_TYPE_LOCATION, a hash array where each item represents one level of the multilevel select, the key is the level name and the value is a hash array with the following keys:titleThe title of the levelfieldNameThe name of the field on the table that stores this level value
$tableName
The name of the database table where this items are stored.
Last updated
Was this helpful?