Fix phpcs line length violations and multiple properties per line

This commit is contained in:
Robbie Averill 2019-01-09 20:59:28 +01:00
parent 467818a49d
commit 5cbe29ae68
4 changed files with 25 additions and 11 deletions

View File

@ -59,7 +59,8 @@ use SilverStripe\View\ViewableData;
* Right now, all subclasses of SS_Report will be shown in the ReportAdmin. In SS3 there is only * Right now, all subclasses of SS_Report will be shown in the ReportAdmin. In SS3 there is only
* one place where reports can go, so this class is greatly simplifed from its version in SS2. * one place where reports can go, so this class is greatly simplifed from its version in SS2.
* *
* @method SS_List|DataList sourceRecords($params = [], $sort = null, $limit = null) List of records to show for this report * @method SS_List|DataList sourceRecords($params = [], $sort = null, $limit = null)
* List of records to show for this report
*/ */
class Report extends ViewableData class Report extends ViewableData
{ {
@ -149,7 +150,11 @@ class Report extends ViewableData
if ($this->hasMethod('sourceRecords')) { if ($this->hasMethod('sourceRecords')) {
return $this->sourceRecords($params, null, null)->dataQuery(); return $this->sourceRecords($params, null, null)->dataQuery();
} else { } else {
user_error("Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()", E_USER_ERROR); user_error(
"Please override sourceQuery()/sourceRecords() and columns() or, if necessary, "
. "override getReportField()",
E_USER_ERROR
);
} }
} }
@ -313,7 +318,10 @@ class Report extends ViewableData
} }
// Add a search button // Add a search button
$formAction = FormAction::create('updatereport', _t('SilverStripe\\Forms\\GridField\\GridField.Filter', 'Filter')); $formAction = FormAction::create(
'updatereport',
_t('SilverStripe\\Forms\\GridField\\GridField.Filter', 'Filter')
);
$formAction->addExtraClass('btn-primary mb-4'); $formAction->addExtraClass('btn-primary mb-4');
$fields->push($formAction); $fields->push($formAction);

View File

@ -174,10 +174,13 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
if ($this->reportObject) { if ($this->reportObject) {
//build breadcrumb trail to the current report //build breadcrumb trail to the current report
$items->push(new ArrayData(array( $items->push(ArrayData::create([
'Title' => $this->reportObject->title(), 'Title' => $this->reportObject->title(),
'Link' => Controller::join_links($this->Link(), '?' . http_build_query(array('q' => $this->request->requestVar('q')))) 'Link' => Controller::join_links(
))); $this->Link(),
'?' . http_build_query(['q' => $this->request->requestVar('q')])
)
]));
} }
return $items; return $items;
@ -226,7 +229,8 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
); );
$gridField = new GridField('Reports', false, $this->Reports(), $gridFieldConfig); $gridField = new GridField('Reports', false, $this->Reports(), $gridFieldConfig);
/** @var GridFieldDataColumns $columns */ /** @var GridFieldDataColumns $columns */
$columns = $gridField->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns'); $columns = $gridField->getConfig()
->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setDisplayFields(array( $columns->setDisplayFields(array(
'title' => _t('SilverStripe\\Reports\\ReportAdmin.ReportTitle', 'Title'), 'title' => _t('SilverStripe\\Reports\\ReportAdmin.ReportTitle', 'Title'),
)); ));
@ -240,7 +244,9 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
$actions = new FieldList(); $actions = new FieldList();
$form = new Form($this, "EditForm", $fields, $actions); $form = new Form($this, "EditForm", $fields, $actions);
$form->addExtraClass('panel panel--padded panel--scrollable cms-edit-form cms-panel-padded' . $this->BaseCSSClasses()); $form->addExtraClass(
'panel panel--padded panel--scrollable cms-edit-form cms-panel-padded' . $this->BaseCSSClasses()
);
$form->loadDataFrom($this->request->getVars()); $form->loadDataFrom($this->request->getVars());
$this->extend('updateEditForm', $form); $this->extend('updateEditForm', $form);

View File

@ -21,7 +21,7 @@ abstract class ReportWrapper extends Report
public function __construct($baseReport) public function __construct($baseReport)
{ {
$this->baseReport = is_string($baseReport) ? new $baseReport : $baseReport; $this->baseReport = is_string($baseReport) ? new $baseReport() : $baseReport;
$this->dataClass = $this->baseReport->dataClass(); $this->dataClass = $this->baseReport->dataClass();
parent::__construct(); parent::__construct();
} }

View File

@ -11,8 +11,8 @@ use SilverStripe\View\ViewableData;
*/ */
class SideReportView extends ViewableData class SideReportView extends ViewableData
{ {
protected $controller;
protected $controller, $report; protected $report;
protected $parameters; protected $parameters;
public function __construct($controller, $report) public function __construct($controller, $report)