mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
2faf391999
Remove hardcoded references to pages and SiteTree Remove assumption that records are versioned Remove or validate assumptions about methods on the model class Improve general architecture of CMSMain
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\CMS\Controllers;
|
|
|
|
use SilverStripe\Forms\Form;
|
|
use SilverStripe\Model\ArrayData;
|
|
|
|
class CMSPageSettingsController extends CMSMain
|
|
{
|
|
|
|
private static $url_segment = 'pages/settings';
|
|
|
|
private static $url_rule = '/$Action/$ID/$OtherID';
|
|
|
|
private static $url_priority = 42;
|
|
|
|
private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
|
|
|
|
public function getEditForm($id = null, $fields = null): Form
|
|
{
|
|
$record = $this->getRecord($id ?: $this->currentRecordID());
|
|
|
|
// @TODO ideally settings isn't its own special thing...
|
|
// can we refactor this so it's just another tab in the main form? And just have it lazyload or something?
|
|
// At the very least this tab must NOT appear if there are no fields for it.
|
|
if ($record && $record->hasMethod('getSettingsFields')) {
|
|
$fields = $record->getSettingsFields();
|
|
} else {
|
|
$fields = null;
|
|
}
|
|
return parent::getEditForm($id, $fields);
|
|
}
|
|
|
|
public function getTabIdentifier()
|
|
{
|
|
return 'settings';
|
|
}
|
|
}
|