Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Re: Sorting CMSFields

$
0
0

Hi Bereusei,

The fields are ordered in whichever order you add them to the FieldList. For example:

$fields = new FieldList();
$fieldA = new TextField('Foo', 'Foo');
$fieldB = new TextField('Bar', 'Bar');

$fields->push($fieldB);
$fields->push($fieldA);

This will result in 'Field B' being added before 'Field A'.

If you're not creating the fields yourself, and are allowing the form scaffolder to create them for you, you can re-order them with:

$fields = parent::getCMSFields();
$fields->changeFieldOrder(
'Foo',
'Bar'
);
return $fields;

Loz


Posted to: Sorting CMSFields | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles