ATK Attribute Flags
Appearance
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|AF_OBLIGATORY));
Available flags for all attributes
This is a list of flags that are common to all attributes. (some attributes have additional flags)
- (atkattribute ) AF_OBLIGATORY
- Value must be entered
- (atkattribute ) AF_UNIQUE
- Value must be unique
- (atkattribute ) AF_PRIMARY| AF_OBLIGATORY
- Part of the primary-key node, also makes it obligatory
- (atkattribute ) AF_AUTO_INCREMENT
- Auto-increment field
- (atkattribute ) AF_AUTOINCREMENT = AF_AUTO_INCREMENT
- (Alias for AF_AUTO_INCREMENT (auto-increment flag is often mistyped)
- (atkattribute ) AF_HIDE_LIST
- Don't show in record lists hide flag
- (atkattribute ) AF_HIDE_ADD
- Don't show on add pages hide flag
- (atkattribute ) AF_HIDE_EDIT
- Don't show on edit pages hide flag
- (atkattribute ) AF_HIDE_SELECT
- Don't show on select pages hide flag
- (atkattribute ) AF_HIDE_VIEW
- Don't show on view pages hide flag
- (atkattribute ) AF_HIDE_SEARCH
- Not searchable in extended search
- (atkattribute ) 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.
- (atkattribute ) AF_HIDE = AF_HIDE_EDIT | AF_HIDE_ADD | AF_HIDE_LIST | AF_HIDE_SEARCH | AF_HIDE_VIEW | AF_HIDE_SELECT
- 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)
- (atkattribute ) AF_READONLY_ADD
- Readonly in add
- (atkattribute ) AF_READONLY_EDIT
- Readonly when edited
- (atkattribute ) AF_READONLY = AF_READONLY_EDIT | AF_READONLY_ADD
- Always readonly
- (atkattribute ) 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.
- (atkattribute ) AF_NOLABEL = AF_NO_LABEL
- No label in forms
- (atkattribute ) 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.
- (atkattribute ) AF_BLANKLABEL = AF_BLANK_LABEL
- Blank label in forms
- (atkattribute ) AF_NO_SORT
- Cannot be sorted in recordlists.
- (atkattribute ) AF_NOSORT = AF_NO_SORT
- Cannot be sorted in recordlists
- (atkattribute ) AF_SEARCHABLE
- Attribute is searchable in list views
- (atkattribute ) 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.
- (atkattribute ) AF_POPUP
- Attributes that support this flag, like the atkFileAttribute, open a popup instead of showing their contents directly in the recordlist.
- (atkattribute ) 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.
- (atkattribute ) 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.
- (atkattribute ) 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.
- (atkattribute ) 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
- (atkattribute ) AF_NO_QUOTES
- No quotes are used when adding to database
- (atkattribute ) AF_ML
- Multi-language field
- (atkattribute ) AF_MULTILANGUAGE = AF_ML
- Indicates which attribute is used to store the languagecode. Used in combination with NF_MULTILANGUAGE
- (atkattribute ) AF_AUTOKEY = AF_PRIMARY | AF_HIDE |AF_AUTOINCREMENT
- Shortcut for hidden auto-incremented primary key
- (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.
- (atkboolattribute ) 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.
- (atkboolattribute ) 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.
- (atkdateattribute ) AF_DATE_EMPTYFIELD With this flag set, it is possible for the user to select a null-date.
- (atkdateattribute ) AF_DATE_NO_CALENDAR
- Do not append the popup calendar.
- (atkdateattribute ) AF_DATE_DISPLAY_DAY
- Show the day of the week in the display
- (atkdateattribute ) AF_DATE_EDIT_NO_DAY
- Don't display the day of the week in edit mode
- (atkdateattribute ) AF_CLEAR_TOUCH_BUTTONS
- Display buttons to clear and 'touch' date
- (atkdatetimeattribute ) AF_CLEAR_TOUCH_BUTTONS
- Display buttons to clear and 'touch' date
- (atkdummyattribute ) AF_DUMMY_SHOW_LABEL
- Make the attribute label its field. Use the flag AF_NOLABEL if you want to start at the beginning of the line.
- (atkdurationattribute ) AF_DURATION_STRING
- Date must be entered as an english date string (strtotime)
- (atkfileattribute ) AF_FILE_NO_UPLOAD
- Disable uploading of files
- (atkfileattribute ) 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.
- (atkfileattribute ) 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).
- (atkfileattribute ) 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.
- (atkfileattribute ) AF_FILE_PHYSICAL_DELETE
- If the file is removed from the database, the physical file is also removed from the server.
- (atkfileattribute ) AF_FILE_POPUP AF_POPUP
- Instead of directly displaying the image, the attribute will display a link to a popup, if this flag is set
- (atkipattribute ) AF_IP_ALLOW_WILDCARDS
- Allow *
- (atkipattribute ) AF_IP_STORENUMERIC
- Store as numeric value
- (atkipattribute ) AF_IP_SINGLEFIELD
- Single field xxx.xxx.xxx.xxx instead of deault 4 fields xxx xxx xxx xxx
- (atklistattribute ) AF_NO_TRANSLATION
- Do not translate the options
- (atklistattribute ) AF_LIST_NO_OBLIGATORY_NULL_ITEM
- Do not add a default null option.
- (atklistattribute ) AF_LIST_NO_NULL_ITEM
- Do not add null option ever
- (atklistattribute ) AF_LIST_OBLIGATORY_NULL_ITEM
- Add a default null option to obligatory items
- (atklivetextpreview AF_LIVETEXT_SHOWLABEL = AF_DUMMY_SHOW_LABEL
- Label the preview
- (atklivetextpreview AF_LIVETEXT_NL2BR
- “nl2br” the data before display
- (atkmultiselectattribute ) AF_NO_TOGGLELINKS
- ????
- (atkmultiselectattribute ) AF_CHECK_ALL
- ????
- (atkmultiselectattribute ) AF_LINKS_BOTTOM
- ????
- (atkpasswordattribute ) AF_PASSWORD_NOVALIDATE
- Disables password check when editing password field
- (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).
- (atkpasswordattribute ) AF_PASSWORD_NOVALIDATE = 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).
- (atkpasswordattribute ) AF_PASSWORD_NO_ENCODE
- Don’t encode (with md5)
- (atkradioattribute ) AF_DISPLAY_VERT
- Displays the set of radio buttons vertically instead of horizontal default
- (atktabbedpane AF_TABBEDPANE_NO_AUTO_HIDE_LABEL
- Do not hide attribute label when it is single on the tab
- (atktimeattribute ) AF_TIME_SECONDS
- Display seconds after hours & minutes
- (atktimeattribute ) AF_CLEAR_TOUCH_BUTTONS
- Display buttons to clear and 'touch' date
- (atkurlattribute ) AF_URL_ALLOWWRAP
- Add one space after each "/", "?" and "&" to fit a (long) url into .
- (atkurlattribute ) AF_URL_STRIPHTTP
- Don't display "http://". Link remains intact.
- (atkweekdayattribute ) AF_WEEKDAY_SMALL_EDIT
- ????
Attribute specific flags
- 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".
- 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.
- AF_DUMMY_SHOW_LABEL
- This flag makes the dummy have a label, just like other attributes.
- 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.
- 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.
- 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
- AF_DISPLAY_VERT
- Align the options vertically instead of horizontally.
- 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.
- 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.
- 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
- AF_MANYBOOL_NO_TOOLBAR
- Hides the 'Select All/Select None/Invert Selection' toolbar.