ATK Attribute Flags: Difference between revisions
Appearance
m ATK Reference Attributes Flags moved to ATK Attribute Flags |
menu |
||
| Line 85: | Line 85: | ||
* AF_DUMMY_SHOW_LABEL This flag makes the dummy have a label, just like other attributes. | * AF_DUMMY_SHOW_LABEL This flag makes the dummy have a label, just like other attributes. | ||
<div style="background: silver; padding: 5px 2px 5px 2px; margin-bottom: 20px;"> | |||
'''Atk Flags''' | |||
[[ATK Attribute Flags]] | [[Module Flags]] | [[Node Flags]] | |||
</div> | |||
Revision as of 03:22, 20 December 2006
Intro
Most attributes have a $flags param in the constructor. You can pass multiple flags by concatting 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.
- AF_FORCE_LOADNormally, 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_LABELDon'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_LABELDon'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 If an attribute is multilingual, ATK uses this flag to enable the auto-multilanguage feature for this attribute. (Note: this functionality is not available in the ATK-light version that ships with Achievo.)
Attribute specific flags
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.
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.
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.
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.
atkOneToManyRelation
- AF_ONETOMANY_EMBED If this flag is set, the 'add' form for new child records is loaded inline, rather than in a new page.
atkDummyAttribute
- AF_DUMMY_SHOW_LABEL This flag makes the dummy have a label, just like other attributes.
Atk Flags