Source of file GridFieldOrderablePages.php
Size: 1,209 Bytes - Last Modified: 2021-12-23T10:04:42+00:00
/var/www/docs.ssmods.com/process/src/src/GridFieldOrderablePages.php
123456789101112131415161718192021222324252627282930313233343536 | <?php namespace Restruct\Silverstripe\GridFieldPages; use SilverStripe\CMS\Controllers\CMSMain; use SilverStripe\Forms\GridField\GridField; use SilverStripe\View\Requirements; use \Symbiote\GridFieldExtensions\GridFieldOrderableRows; class GridFieldOrderablePages extends GridFieldOrderableRows { /** * @param GridField $field */ public function getHTMLFragments($field) { parent::getHTMLFragments($field); Requirements::javascript('micschk/silverstripe-gridfieldpages:client/js/gridfieldpages.js'); /** * We call CMSMain savetreenode to update just the position of the reordered page without marking all siblings as changed. * * Required data: * - 'ID': The moved node * - 'ParentID': New parent relation of the moved node (0 for root) * - 'SiblingIDs': Array of all sibling nodes to the moved node (incl. the node itself). * In case of a 'ParentID' change, relates to the new siblings under the new parent. */ $field->setAttribute('data-url-pagereorder', CMSMain::create()->Link('edit/savetreenode')); $field->addExtraClass('ss-gridfield-orderable-pages'); } } |