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,
|
||||
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 ###
|
||||
|
||||
Please use this static property to describe the purpose of your page types,
|
||||
|
@ -321,7 +321,7 @@ class File extends DataObject {
|
||||
*
|
||||
* @return FieldList
|
||||
*/
|
||||
function getCMSFields($params = null) {
|
||||
function getCMSFields() {
|
||||
// Preview
|
||||
if($this instanceof Image) {
|
||||
$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}
|
||||
* and implemeting updateCMSFields(FieldList $fields) on that extension.
|
||||
*/
|
||||
function getCMSFields($param = null) {
|
||||
function getCMSFields() {
|
||||
// Hide field on root level, which can't be renamed
|
||||
if(!$this->ID || $this->ID === "root") {
|
||||
$titleField = new HiddenField("Name");
|
||||
|
@ -1837,18 +1837,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
public function getCMSFields($params = null) {
|
||||
$tabbedFields = $this->scaffoldFormFields(array_merge(
|
||||
array(
|
||||
// Don't allow has_many/many_many relationship editing before the record is first saved
|
||||
'includeRelations' => ($this->ID > 0),
|
||||
'tabbed' => true,
|
||||
'ajaxSafe' => true
|
||||
),
|
||||
(array)$params
|
||||
public function getCMSFields() {
|
||||
$tabbedFields = $this->scaffoldFormFields(array(
|
||||
// Don't allow has_many/many_many relationship editing before the record is first saved
|
||||
'includeRelations' => ($this->ID > 0),
|
||||
'tabbed' => true,
|
||||
'ajaxSafe' => true
|
||||
));
|
||||
|
||||
$this->extend('updateCMSFields', $tabbedFields);
|
||||
|
@ -73,8 +73,8 @@ class Image extends File {
|
||||
parent::defineMethods();
|
||||
}
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$urlLink = "<div class='field readonly'>";
|
||||
$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
|
||||
|
@ -59,7 +59,7 @@ class Group extends DataObject {
|
||||
*
|
||||
* @return FieldList
|
||||
*/
|
||||
public function getCMSFields($params = null) {
|
||||
public function getCMSFields() {
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
|
||||
|
||||
$fields = new FieldList(
|
||||
|
@ -1084,7 +1084,7 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
* @return FieldList Return a FieldList of fields that would appropriate for
|
||||
* editing this member.
|
||||
*/
|
||||
public function getCMSFields($params = null) {
|
||||
public function getCMSFields() {
|
||||
require_once('Zend/Date.php');
|
||||
|
||||
$fields = parent::getCMSFields();
|
||||
|
@ -33,8 +33,8 @@ class PermissionRole extends DataObject {
|
||||
|
||||
static $plural_name = 'Roles';
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$fields->removeFieldFromTab('Root', 'Codes');
|
||||
$fields->removeFieldFromTab('Root', 'Groups');
|
||||
|
@ -143,8 +143,8 @@ class GridFieldDetailFormTest_Person extends DataObject implements TestOnly {
|
||||
'Categories' => 'GridFieldDetailFormTest_Category'
|
||||
);
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
// TODO No longer necessary once FormScaffolder uses GridField
|
||||
$fields->replaceField('Categories',
|
||||
GridField::create('Categories', 'Categories',
|
||||
@ -165,8 +165,8 @@ class GridFieldDetailFormTest_PeopleGroup extends DataObject implements TestOnly
|
||||
'People' => 'GridFieldDetailFormTest_Person'
|
||||
);
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
// TODO No longer necessary once FormScaffolder uses GridField
|
||||
$fields->replaceField('People',
|
||||
GridField::create('People', 'People',
|
||||
@ -187,8 +187,8 @@ class GridFieldDetailFormTest_Category extends DataObject implements TestOnly {
|
||||
'People' => 'GridFieldDetailFormTest_Person'
|
||||
);
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
// TODO No longer necessary once FormScaffolder uses GridField
|
||||
$fields->replaceField('People',
|
||||
GridField::create('People', 'People',
|
||||
|
@ -62,8 +62,8 @@ class DataDifferencerTest_Object extends DataObject implements TestOnly {
|
||||
'HasOneRelation' => 'DataDifferencerTest_HasOneRelationObject'
|
||||
);
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
$choices = array(
|
||||
'a' => 'a',
|
||||
'b' => 'b',
|
||||
|
@ -136,7 +136,7 @@ class GroupTest extends FunctionalTest {
|
||||
|
||||
class GroupTest_Member extends Member implements TestOnly {
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
function getCMSFields() {
|
||||
$groups = DataObject::get('Group');
|
||||
$groupsMap = ($groups) ? $groups->map() : false;
|
||||
$fields = new FieldList(
|
||||
|
Loading…
x
Reference in New Issue
Block a user