Grouping attributes: Difference between revisions
No edit summary |
|||
| Line 12: | Line 12: | ||
Groups are a list of attributes that will be placed on 1 line with or without a border (html fieldset). Every group that you create will always appear on top of the other attributes! | Groups are a list of attributes that will be placed on 1 line with or without a border (html fieldset). Every group that you create will always appear on top of the other attributes! | ||
Syntax: | Syntax: | ||
<syntaxhighlight lang="php"> | |||
$this->addGroup("groupname",array("attrib1","attrib2"),<border>,"tab"); | |||
</syntaxhighlight> | |||
in your node file use the following line to group two attributes with a surrounding box on the main tab: | in your node file use the following line to group two attributes with a surrounding box on the main tab: | ||
<syntaxhighlight lang="php"> | |||
$this->addGroup("users",array("user_lastvisit","user_regdate"),TRUE,"main"); | $this->addGroup("users",array("user_lastvisit","user_regdate"),TRUE,"main"); | ||
</syntaxhighlight> | |||
and this to group two attributes without a surrounding box on the details tab: | and this to group two attributes without a surrounding box on the details tab: | ||
<syntaxhighlight lang="php"> | |||
$this->addGroup("dates",array("user_level","user_posts"),FALSE,"details"); | $this->addGroup("dates",array("user_level","user_posts"),FALSE,"details"); | ||
</syntaxhighlight> | |||
'''Note:''' Groups only work with the steelblue theme at the moment! | '''Note:''' Groups only work with the steelblue theme at the moment! | ||
| Line 31: | Line 36: | ||
Sections always appear at the bottom. | Sections always appear at the bottom. | ||
Syntax: $this->add(new atkAttribute('test'),'default.section'); | Syntax: | ||
<syntaxhighlight lang="php"> | |||
$this->add(new atkAttribute('test'),'default.section'); | |||
</syntaxhighlight> | |||
In your node file use the following line to add an acttribute to the section 'address': | In your node file use the following line to add an acttribute to the section 'address': | ||
<syntaxhighlight lang="php"> | |||
$this->add(new atkNumberAttribute('housenumber'), 'default.address'); | |||
$this->add(new atkAttribute('housenumber_suffix'), 'default.address'); | |||
</syntaxhighlight> | |||
The convention is: <tabname>.<sectionname>, in other words, the above places the attributes in the 'address' section of the default tab. Accepted notations: | |||
* ".address" - Put attribute in the address section if there are no tabs, or on the default tab | |||
* "billing" - Put attribute on the address tab | |||
* "billing.address" - Put attribute in the address section of the billing tab | |||
Revision as of 17:06, 4 June 2008
|
ATK Howto: Grouping attributes
|
Requirements
ATK 6.2+
Summary
In a node it's possible to group attributes for an edit form on 2 ways. With a group and a section.
Groups
Groups are a list of attributes that will be placed on 1 line with or without a border (html fieldset). Every group that you create will always appear on top of the other attributes!
Syntax:
$this->addGroup("groupname",array("attrib1","attrib2"),<border>,"tab");
in your node file use the following line to group two attributes with a surrounding box on the main tab:
$this->addGroup("users",array("user_lastvisit","user_regdate"),TRUE,"main");
and this to group two attributes without a surrounding box on the details tab:
$this->addGroup("dates",array("user_level","user_posts"),FALSE,"details");
Note: Groups only work with the steelblue theme at the moment!
Sections
Groups a list with attributes on multiple lines which are collapsed by default. When you open a section it will retrieve the attributes with ajax. Sections always appear at the bottom.
Syntax:
$this->add(new atkAttribute('test'),'default.section');
In your node file use the following line to add an acttribute to the section 'address':
$this->add(new atkNumberAttribute('housenumber'), 'default.address');
$this->add(new atkAttribute('housenumber_suffix'), 'default.address');
The convention is: <tabname>.<sectionname>, in other words, the above places the attributes in the 'address' section of the default tab. Accepted notations:
- ".address" - Put attribute in the address section if there are no tabs, or on the default tab
- "billing" - Put attribute on the address tab
- "billing.address" - Put attribute in the address section of the billing tab