mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
updated to create syntax
This commit is contained in:
parent
07c97e45b2
commit
8e77095de0
@ -112,8 +112,7 @@ By default `GridFieldOrderableRows` will handle versioning but won't automatical
|
||||
You can configure the list to automatically publish a record if the record is the latest version and is already published. This won't publish any records which have draft changes.
|
||||
|
||||
```php
|
||||
$orderable = new GridFieldOrderableRows()
|
||||
->setRepublishLiveRecords(true);
|
||||
$orderable = GridFieldOrderableRows::create()->setRepublishLiveRecords(true);
|
||||
```
|
||||
|
||||
There are caveats with both approaches so consideration should be made for which approach best suits the requirements.
|
||||
|
@ -101,6 +101,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
|
||||
/**
|
||||
* @param string $sortField
|
||||
* @param boolean $republishLiveRecords
|
||||
*/
|
||||
public function __construct($sortField = 'Sort')
|
||||
{
|
||||
@ -689,7 +690,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
$record = $currentSortList[$targetRecordID];
|
||||
if ($record->$sortField != $newSortValue) {
|
||||
$record->$sortField = $newSortValue;
|
||||
|
||||
|
||||
// We need to do this before writing otherwith isLiveVersion() will always be false
|
||||
$shouldRepublish = $this->getRepublishLiveRecords() && $record->isLiveVersion();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user