mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API CHANGE Removed $params argument to DataObject->getCMSFields(), please use FormScaffolder directly (fixes #7135)
This commit is contained in:
parent
0f8a6999a1
commit
8ba9c3ca6b
@ -226,6 +226,10 @@ in the "Behaviour" or "Access" tab, please move these customizations to a new `g
|
|||||||
In case of SiteTree extension through `updateCMSFields()` and a decorator/extension,
|
In case of SiteTree extension through `updateCMSFields()` and a decorator/extension,
|
||||||
please use the new `updateSettingsFields()` instead.
|
please use the new `updateSettingsFields()` instead.
|
||||||
|
|
||||||
|
We've also removed the `$params` attribute on `DataObject->getCMSFields()`
|
||||||
|
which could be used as a shortcut for customizations to `FormScaffolder`,
|
||||||
|
in order to achieve E_STRICT compliance. Please use `FormScaffolder` directly.
|
||||||
|
|
||||||
### New `SiteTree::$description` field to describe purpose of a page type ###
|
### New `SiteTree::$description` field to describe purpose of a page type ###
|
||||||
|
|
||||||
Please use this static property to describe the purpose of your page types,
|
Please use this static property to describe the purpose of your page types,
|
||||||
|
@ -321,7 +321,7 @@ class File extends DataObject {
|
|||||||
*
|
*
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
// Preview
|
// Preview
|
||||||
if($this instanceof Image) {
|
if($this instanceof Image) {
|
||||||
$formattedImage = $this->getFormattedImage('SetWidth', Image::$asset_preview_width);
|
$formattedImage = $this->getFormattedImage('SetWidth', Image::$asset_preview_width);
|
||||||
|
@ -406,7 +406,7 @@ class Folder extends File {
|
|||||||
* You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
|
* You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
|
||||||
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
||||||
*/
|
*/
|
||||||
function getCMSFields($param = null) {
|
function getCMSFields() {
|
||||||
// Hide field on root level, which can't be renamed
|
// Hide field on root level, which can't be renamed
|
||||||
if(!$this->ID || $this->ID === "root") {
|
if(!$this->ID || $this->ID === "root") {
|
||||||
$titleField = new HiddenField("Name");
|
$titleField = new HiddenField("Name");
|
||||||
|
@ -1837,18 +1837,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
*
|
*
|
||||||
* @see Good example of complex FormField building: SiteTree::getCMSFields()
|
* @see Good example of complex FormField building: SiteTree::getCMSFields()
|
||||||
*
|
*
|
||||||
* @param array $params See {@link scaffoldFormFields()}
|
|
||||||
* @return FieldList Returns a TabSet for usage within the CMS - don't use for frontend forms.
|
* @return FieldList Returns a TabSet for usage within the CMS - don't use for frontend forms.
|
||||||
*/
|
*/
|
||||||
public function getCMSFields($params = null) {
|
public function getCMSFields() {
|
||||||
$tabbedFields = $this->scaffoldFormFields(array_merge(
|
$tabbedFields = $this->scaffoldFormFields(array(
|
||||||
array(
|
// Don't allow has_many/many_many relationship editing before the record is first saved
|
||||||
// Don't allow has_many/many_many relationship editing before the record is first saved
|
'includeRelations' => ($this->ID > 0),
|
||||||
'includeRelations' => ($this->ID > 0),
|
'tabbed' => true,
|
||||||
'tabbed' => true,
|
'ajaxSafe' => true
|
||||||
'ajaxSafe' => true
|
|
||||||
),
|
|
||||||
(array)$params
|
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->extend('updateCMSFields', $tabbedFields);
|
$this->extend('updateCMSFields', $tabbedFields);
|
||||||
|
@ -73,8 +73,8 @@ class Image extends File {
|
|||||||
parent::defineMethods();
|
parent::defineMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields($params);
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$urlLink = "<div class='field readonly'>";
|
$urlLink = "<div class='field readonly'>";
|
||||||
$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
|
$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
|
||||||
|
@ -59,7 +59,7 @@ class Group extends DataObject {
|
|||||||
*
|
*
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
public function getCMSFields($params = null) {
|
public function getCMSFields() {
|
||||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
|
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
|
||||||
|
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
|
@ -1084,7 +1084,7 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
|||||||
* @return FieldList Return a FieldList of fields that would appropriate for
|
* @return FieldList Return a FieldList of fields that would appropriate for
|
||||||
* editing this member.
|
* editing this member.
|
||||||
*/
|
*/
|
||||||
public function getCMSFields($params = null) {
|
public function getCMSFields() {
|
||||||
require_once('Zend/Date.php');
|
require_once('Zend/Date.php');
|
||||||
|
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
@ -33,8 +33,8 @@ class PermissionRole extends DataObject {
|
|||||||
|
|
||||||
static $plural_name = 'Roles';
|
static $plural_name = 'Roles';
|
||||||
|
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields($params);
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$fields->removeFieldFromTab('Root', 'Codes');
|
$fields->removeFieldFromTab('Root', 'Codes');
|
||||||
$fields->removeFieldFromTab('Root', 'Groups');
|
$fields->removeFieldFromTab('Root', 'Groups');
|
||||||
|
@ -143,8 +143,8 @@ class GridFieldDetailFormTest_Person extends DataObject implements TestOnly {
|
|||||||
'Categories' => 'GridFieldDetailFormTest_Category'
|
'Categories' => 'GridFieldDetailFormTest_Category'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields($params);
|
$fields = parent::getCMSFields();
|
||||||
// TODO No longer necessary once FormScaffolder uses GridField
|
// TODO No longer necessary once FormScaffolder uses GridField
|
||||||
$fields->replaceField('Categories',
|
$fields->replaceField('Categories',
|
||||||
GridField::create('Categories', 'Categories',
|
GridField::create('Categories', 'Categories',
|
||||||
@ -165,8 +165,8 @@ class GridFieldDetailFormTest_PeopleGroup extends DataObject implements TestOnly
|
|||||||
'People' => 'GridFieldDetailFormTest_Person'
|
'People' => 'GridFieldDetailFormTest_Person'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields($params);
|
$fields = parent::getCMSFields();
|
||||||
// TODO No longer necessary once FormScaffolder uses GridField
|
// TODO No longer necessary once FormScaffolder uses GridField
|
||||||
$fields->replaceField('People',
|
$fields->replaceField('People',
|
||||||
GridField::create('People', 'People',
|
GridField::create('People', 'People',
|
||||||
@ -187,8 +187,8 @@ class GridFieldDetailFormTest_Category extends DataObject implements TestOnly {
|
|||||||
'People' => 'GridFieldDetailFormTest_Person'
|
'People' => 'GridFieldDetailFormTest_Person'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields($params);
|
$fields = parent::getCMSFields();
|
||||||
// TODO No longer necessary once FormScaffolder uses GridField
|
// TODO No longer necessary once FormScaffolder uses GridField
|
||||||
$fields->replaceField('People',
|
$fields->replaceField('People',
|
||||||
GridField::create('People', 'People',
|
GridField::create('People', 'People',
|
||||||
|
@ -62,8 +62,8 @@ class DataDifferencerTest_Object extends DataObject implements TestOnly {
|
|||||||
'HasOneRelation' => 'DataDifferencerTest_HasOneRelationObject'
|
'HasOneRelation' => 'DataDifferencerTest_HasOneRelationObject'
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields($params);
|
$fields = parent::getCMSFields();
|
||||||
$choices = array(
|
$choices = array(
|
||||||
'a' => 'a',
|
'a' => 'a',
|
||||||
'b' => 'b',
|
'b' => 'b',
|
||||||
|
@ -136,7 +136,7 @@ class GroupTest extends FunctionalTest {
|
|||||||
|
|
||||||
class GroupTest_Member extends Member implements TestOnly {
|
class GroupTest_Member extends Member implements TestOnly {
|
||||||
|
|
||||||
function getCMSFields($params = null) {
|
function getCMSFields() {
|
||||||
$groups = DataObject::get('Group');
|
$groups = DataObject::get('Group');
|
||||||
$groupsMap = ($groups) ? $groups->map() : false;
|
$groupsMap = ($groups) ? $groups->map() : false;
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user