ATK Attribute Flags

From Achievo/ATK Wiki

Jump to: navigation, search

Contents

Intro

Most attributes have a $flags param in the constructor. You can pass multiple flags by concatenating them with a pipe symbol (|).

Example:

$this->add(new atkAttribute("name", AF_SEARCHABLE));

Available flags for all attributes

This is a list of flags that are common to all attributes. (some attributes have additional flags)

AF_OBLIGATORY
Field is required. A value must be entered by the user.
AF_UNIQUE
The value entered by the user must be unique.
AF_PRIMARY
This attribute is (part of) the primary key of the table represented by the node.
AF_AUTO_INCREMENT
The attribute value is incremented automatically for each newly added record.
AF_AUTOINCREMENT
This flag is an alias to AF_AUTO_INCREMENT and is identical in every way.
AF_AUTOKEY
Indicates that the attribute is a hidden, autoincremented primary key. (This is actually an alias for AF_AUTOINCREMENT|AF_PRIMARY|AF_HIDE.)
AF_HIDE_LIST
The attribute is hidden in record lists.
AF_HIDE_ADD
The attribute is hidden in add-forms.
AF_HIDE_EDIT
The attribute is hidden in edit-forms.
AF_HIDE_SELECT
The attribute is hidden in select-pages.
AF_HIDE_VIEW
The attribute is hidden in view-pages.
AF_HIDE_SEARCH
The attribute is hidden in extended search pages.
AF_HIDE
Attribute is always hidden. Note that this will typically cause the attribute not to be loaded and not available in $record; if this is undesirable add the flag AF_FORCE_LOAD (see below).
AF_FORCE_LOAD
Normally, when an attribute is hidden, its value is not loaded from the database. Sometimes however you need the value, even though it is hidden (for example to influence the display of another attribute). In this case, the AF_FORCE_LOAD flag will ensure that the attribute value is always loaded, regardless of whether it's hidden or not.
AF_READONLY_ADD
In add-pages, the attribute is read-only.
AF_READONLY_EDIT
In edit-pages, the attribute is read-only.
AF_READONLY
The attribute is read-only in both edit- and add-pages.
AF_NO_LABEL
Don't display the attribute name as a label in front of the attribute. The attribute is displayed directly at the position the label would normally be.
AF_NOLABEL
This flag is an alias to AF_NO_LABEL and is identical in every way.
AF_BLANK_LABEL
Don't display the attribute name as a label in front of the attribute. The difference with AF_NO_LABEL is that with this flag the label is replaced with empty space, leaving the attribute itself at its original position.
AF_BLANKLABEL
This flag is an alias to AF_BLANK_LABEL and is identical in every way.
AF_NO_SORT
In recordlist, the column for this attribute is not sortable by the user.
AF_NOSORT
This flag is an alias to AF_NO_SORT and is identical in every way.
AF_SEARCHABLE
This attribute is searchable through the quick-search bar in recordlists.
AF_TOTAL
In recordlists, the column for this attribute is automatically totalized, and the total is displayed in an extra row right under the recordlist.
AF_POPUP
Attributes that support this flag, like the atkFileAttribute, open a popup instead of showing their contents directly in the recordlist.
AF_CASCADE_DELETE
Attributes that support cascade deletes, like the atkOneToManyRelation, will perform delete functionality when this flag is set and a record is deleted.
AF_LARGE
Attributes that support this flag use this flag as a hint that a large number of records will need to be processed. The atkManyToOneRelation uses this flag to prevent dropdowns with too many records.
AF_NO_FILTER
Attributes that support this flag, like the atkManyToOneRelation, will use this flag to determine whether filters on related nodes should be executed.
AF_PARENT
When using an atkTreeNode instead of atkNode, this flag tells the node that the attribute is the foreign key in the parent/child relation. (Note: the atkTreeNode is not available in the ATK-light version that ships with Achievo.)
AF_NO_QUOTES
Atk puts quotes around field values when storing them in the database. Use this flag to indicate that it shouldn't use quotes. This is useful when the value should be treated as a SQL expression instead of a value.
AF_MULTILANGUAGE (alias for AF_ML)
Indicates which attribute is used to store the languagecode. Used in combination with NF_MULTILANGUAGE. Howto: Multilanguage_node (Note: this functionality is not available in the ATK-light version that ships with Achievo.).

Attribute specific flags

atkBoolAttribute

AF_BOOL_OBLIGATORY
Normally a atkBoolAttribute is not flagged obligatory, and if the standard AF_OBLIGATORY flag is set it is automatically removed when the attribute is constructed. If you really really really wants to show this attribute as obligatory, use this flag.
AF_BOOL_INLINE_LABEL
Show an extra label right next to the checkbox. ATK searches the language file for the following variants <attribute>_label, <attribute> (next to the module/node prefixes). Don't forget to add the AF_BLANK_LABEL flag if you don't want to show the normal label.
AF_BOOL_DISPLAY_CHECKBOX
Display checkbox in view / list mode instead of "yes" or "no".

atkDateAttribute

AF_DATE_STRING
Date must be entered as a string, instead of using the date-selection dropdowns. Any string accepted by the php function strtotime is valid input when this flag is set.
AF_DATE_EMPTYFIELD
With this flag set, it is possible for the user to select a null-date.

atkDummyAttribute

AF_DUMMY_SHOW_LABEL
This flag makes the dummy have a label, just like other attributes.

atkFileAttribute

AF_FILE_NO_UPLOAD
Remove the ability to upload new files.
AF_FILE_NO_SELECT
Disable the dropdown to select existing files. If this flag is set, the user can only upload a new file or keep the existing one.
AF_FILE_NO_DELETE
Remove the ability to delete the files (from the database. The physical file is never removed, unless the AF_FILE_PHYSICAL_DELETE flag is set).
AF_FILE_PHYSICAL_DELETE
If the file is removed from the database, the physical file is also removed from the server.
AF_FILE_NO_AUTOPREVIEW
By default, the atkFileAttribute tries to determine the filetype of the uploaded file, and if it's an image, display the image. If this flag is set, the detection is turned off and images are not displayed.
AF_FILE_POPUP
Instead of directly displaying the image, the attribute will display a link to a popup, if this flag is set.

atkPasswordAttribute

AF_PASSWORD_NO_VALIDATE
By default, to change a password, the user must also enter the current password. If this flag is set, entering the current password is not necessary (useful for edit-screens where administrators must manage useraccounts and need to change users' passwords).
AF_PASSWORD_NOVALIDATE
This flag is an alias to AF_PASSWORD_NO_VALIDATE and is identical in every way.

atkListAttribute

AF_NO_TRANSLATION
Do not translate the options
AF_LIST_NO_OBLIGATORY_NULL_ITEM
Do not add a default null option.
AF_LIST_NO_NULL_ITEM
Do not add null option ever
AF_LIST_OBLIGATORY_NULL_ITEM
Add a default null option to obligatory items

atkRadioAttribute

AF_DISPLAY_VERT
Align the options vertically instead of horizontally.

atkManyToOneRelation

AF_RELATION_AUTOLINK
If this flag is set, the edit-dropdown will have 2 additional links; one to edit the currently selected record, and one to add a new record to the dropdown. When displaying the attribute, for example in recordlists, the displayed value is automatically displayed as a link to the view-page of the seleted record.
AF_RELATION_NO_NULL_ITEM
If this flag is set, and $config_list_obligatory_null_item is set to true, to prevent relations from selecting a default record, then this will remove that null item for the relation that has this flag.
AF_MANYTOONE_OBLIGATORY_NULL_ITEM
When AF_OBLIGATORY is used, this makes sure that the first option of the drop down list is set to "none". May be handy if onChange event is set on relation.


AF_RELATION_AUTOCOMPLETE
Instead of a dropdown, the user is presented with a text box that features autocompletion when typing.
AF_MANYTOONE_LAZY
By default, when loading records in a node, the destination record of manytoonerelations is loaded directly with the main query. When this flag is set, it is only loaded when it is needed in an edit screen.

atkOneToOneRelation

AF_ONETOONE_INTEGRATE
If a node has a onetoone relationship with another node, the edit fields of the other node are indented slightly to indicate that they belong to the other node. If the AF_ONETOONE_INTEGRATE flag is set, the other nodes' edit fields are displayed in such a manner that it is invisible to the user that they are part of another node. The user sees the entire edit-page as if all fields belonged to the same node.
AF_ONETOONE_ERROR
For backwardscompatibility reasons, the atkOneToOneRelation does not validate input of the destination node. If this flag is set, validation is done.
AF_ONETOONE_ADD
Override the default no add flag.
AF_ONETOONE_LAZY
Use lazy loading instead of query addition.
AF_ONETOONE_RESPECT_TABS
Respects tab/sections that have been assigned to this attribute instead of using the tabs assigned for the attributes in the destination node. This flag is only useful in integration mode.

atkOneToManyRelation

AF_RESTRICTED_DELETE
Only allow deletion of master item when there are no child records.
AF_ONETOMANY_ADD_DIALOG
Use pop-up dialog for adding records instead of a new page.
AF_ONETOMANY_EMBED
If this flag is set, the 'add' form for new child records is loaded inline, rather than in a new page.

Deprecated: Replaced by AF_ONETOMANY_ADD_DIALOG.

AF_ONETOMANY_ADDORCOPY_DIALOG
Use pop-up dialog for whatever a new record must be copied or must be added.
AF_ONETOMANY_SHOW_ADD
Using this flag it's possible to use the atkOneToManyRelation when you still need to add the master record. The detail records will be temporarily stored in the session until the master record is added.

WARNING: Not on by default because this only works in simple cases, not having an id will lead to strange results for:

  • Nodes that use the foreign key in their descriptor
  • Nodes with unique records (AF_UNIQUE always just checks the database)
  • Combined primary keys

atkManyBoolRelation

AF_MANYBOOL_NO_TOOLBAR
Hides the 'Select All/Select None/Invert Selection' toolbar.


ATK Attribute Flags | Module Flags | Node Flags

Personal tools
Navigation