Jump to:

3429 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » How can I order the fields within a dataobject?

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 641 Views
  • SevenSquared
    Avatar
    Community Member
    1 Post

    How can I order the fields within a dataobject? Link to this post

    Hi Can anyone tell me how I can order the fields for display within a DataObject? I want the SiteTree field to appear above the 'NoLink' field, but it always appears at the bottom. Here is my DataObject Code...

    class ClientResource extends DataObject
    {
       static $db = array (
          'Name' => 'Varchar(255)',
          'NoLink' => 'Boolean',
          'Category' => "Enum('General, Public, Digital')"
          
       );
       
       static $has_one = array (
          'HomePage' => 'HomePage',
          'ClientUrl' => 'SiteTree'
       );
       
       public function getCMSFields_forPopup()
       {
          return new FieldSet(
          
             new TextField('Name'),         
             
             new TreeDropdownField('ClientUrlID', 'Choose a page to link to:', 'SiteTree'),

             new CheckboxField('NoLink'),         
          
             new DropdownField('Category','Category', singleton('ClientResource')->dbObject('Category')->enumValues())
             
          );
       }
    }

    641 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.