Fix linting issues and fix doc

This commit is contained in:
Christopher Joe 2017-10-05 15:28:58 +13:00
parent 6424f4dea0
commit e07658ef50

View File

@ -1,8 +1,6 @@
<?php <?php
namespace SilverStripe\Forms\GridField; namespace SilverStripe\Forms\GridField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridField_ColumnProvider;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
@ -17,8 +15,9 @@ class GridFieldVersionedState implements GridField_ColumnProvider
*/ */
protected $versionedLabelFields = ['Title']; protected $versionedLabelFields = ['Title'];
public function __construct($versionedLabelFields = null) { public function __construct($versionedLabelFields = null)
if($versionedLabelFields) { {
if ($versionedLabelFields) {
$this->versionedLabelFields = $versionedLabelFields; $this->versionedLabelFields = $versionedLabelFields;
} }
} }
@ -37,7 +36,7 @@ class GridFieldVersionedState implements GridField_ColumnProvider
$model = $gridField->getModelClass(); $model = $gridField->getModelClass();
$isModelVersioned = $model::has_extension(Versioned::class); $isModelVersioned = $model::has_extension(Versioned::class);
if(!$isModelVersioned) { if (!$isModelVersioned) {
return; return;
} }
@ -48,9 +47,8 @@ class GridFieldVersionedState implements GridField_ColumnProvider
if (count($matchedVersionedFields) > 0) { if (count($matchedVersionedFields) > 0) {
$this->column = array_values($matchedVersionedFields)[0]; $this->column = array_values($matchedVersionedFields)[0];
} } elseif ($columns) {
// Use first column // Use first column
else if ($columns) {
$this->column = $columns[0]; $this->column = $columns[0];
} }
} }
@ -142,11 +140,11 @@ class GridFieldVersionedState implements GridField_ColumnProvider
* ) * )
* ``` * ```
* *
* @param bool $cached Whether to serve the fields from cache; false * @param DataObject $record - the record to check status for
* regenerate them
* @return array * @return array
*/ */
protected function getStatusFlags($record) { protected function getStatusFlags($record)
{
$flags = array(); $flags = array();
if ($record->isOnLiveOnly()) { if ($record->isOnLiveOnly()) {