"enum"
Purpose: list of possible options like "key-value". Keys are stored in database table.
Field type in SQL table: "int", "float", "char" or "varchar"
Additional parameters
"values_list"
Purpose: the list of possible values in array format (the regular or associative array)
Possible values: array ("green", "blue", "red") or array ("green" => "Green", "blue" => "Blue", "red" =>" Red") (the second type is more preferable)
By default: array()
"empty_value"
Purpose: a possibility to select an empty value for a field and store it in database
Possible values: "true" or the text string which will be shown as a title of an empty value select option
By default: "true"
"foreign_key"
Purpose: the foreign key, in case when values for this field are taken from another model (more details are in
Foreign Keys section)
Possible values: name of a model ("News", "Products")
По умолчанию: "false"
"is_parent"
Purpose: applicable together with "foreign_key", shows that the foreign key values in current field, taken from other model, are parents of records of the current model (such as catalogs of products). The second model should have a "parent" field. More details are described in
Trees section.
Possible values: "true", "false"
By default: "false"
"name_field"
Purpose: applicable together with "foreign_key", when displaying the list of possible values in the linked model, "name" field is being searched for, if not found, you need to specify a field which will be used instead as titles for values in "select" tag
Possible values: name of a field, for example "first_name", "label", "date"
By default: "name"
"name_field_extra"
Purpose: applicable together with "foreign_key" and "name_field", allows to add to the "name_field" field a value of one more field from the linked model for more convenient perception in the list
Possible values: name of a field, for example "last_name", "age", "job"
By default: "false"
"display_radio"
Purpose: sets the view of field values as radio buttons in the form on frontend (the tag "select" is shown by default)
Possible values: "true", "false"
By default: "false"
"long_list"
Purpose: applicable if the list of values has too many options, then values will be received with the help of search string and no "select" tag will be shown
Possible values: "true", "false"
By default: "false"
"show_parent"
Purpose: applicaple together with "foreign_key" and "is_parent", shows the name of the parent for field values additionally
Possible values: "true", "false"
By default: "false"
"multiple_choice"
Purpose: a possibility of a multiple selection, when the field is displayed in the form like the table with checkboxes, the quantity of columns of the table is set by the value of this parameter (applicaple only to the forms that have been built without a model)
Possible values: the positive integer values which needed quantity of columns in the table with checkboxes
By default: "false"
"order_asc", "order_desc"
Purpose: applicapble together with "foreign_key", gives a possibility to sort the list of values of foreign key by one of the fields of the model, by default foreign key values sorting will be done by name (or "name_field")
Possible values: string, name of the model field
By default: "false"
Samples
array("Status", "enum", "status", array("values_list" => array("placed" => "Placed online", "paied" => "Paid", "delivered" => "Delivered to client")) array("City", "enum", "city", array("foreign_key" => "Cities", "empty_value" => "All Cities", "long_list" => true)) array("Brand", "enum", "brand", array("empty_value" => true, "foreign_key" =>"Brands", "order_desc" => "date")) array("Client", "enum", "client", array("foreign_key" => "Clients", "name_field" => "first_name", "name_field_extra" => "last_name")) array("Catalog", "enum", "parent", array("foreign_key" => "Catalogs", "is_parent" => true, "show_parent" => true))
Previous section
"multi_images"