svandragt / silverstripe-fieldlistmovefield
Add helper functions to reorder fields in a FieldList
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 1
Open Issues: 0
Type:silverstripe-module
Requires
This package is not auto-updated.
Last update: 2020-01-20 03:30:36 UTC
README
Add helper functions to reorder fields in a FieldList. You can easily move a field to appear before and after other fields.
Example:
public function getCMSFields() { $fields = parent::getCMSFields(); // Move ModeOfAttendance relation before the Day field $fields->moveBefore('ModeOfAttendanceID','Day'); // Move the Intake relation after the ModeOfAttendance relation $fields->moveAfter('IntakeTypeID','ModeOfAttendanceID'); return $fields; }
For the source field parameter (first argument), you can pass in a field or a field name.
Installation
composer require "svandragt/silverstripe-fieldlistmovefield:*"
The code is straightforward so should work on any 3.x installation.