Created
December 28, 2012 15:45
-
-
Save anonymous/4398989 to your computer and use it in GitHub Desktop.
Add SortableGridField to MemberProfiles module by extending MemberProfilePage.
To enable drag and drop sorting of fields.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MemberProfileFieldExtension extends DataExtension { | |
public static $db = array( | |
'SortOrder' => 'Int' | |
); | |
function updateCMSFields(FieldList $fields) { | |
$fields->push(new NumericField('SortOrder', 'SortOrder')); | |
parent::updateCMSFields($fields); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SortableMemberProfilePage extends MemberProfilePage { | |
public function getCMSFields() { | |
$fields = parent::getCMSFields(); | |
$fields->dataFieldByName('Fields')->getConfig()->addComponent(new GridFieldSortableRows('SortOrder')); | |
return $fields; | |
} | |
} | |
class SortableMemberProfilePage_Controller extends MemberProfilePage_Controller { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment