FIX Update CMS fields now that they're being scaffolded (#198)

This commit is contained in:
Guy Sartorelli 2024-08-15 13:15:22 +12:00 committed by GitHub
parent 19b125829a
commit 18b3ee3129
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 58 additions and 13 deletions

View File

@ -41,8 +41,6 @@ class BasicFieldsTestPage extends TestPage
private static $db = array(
'CalendarDate' => 'Date',
'Checkbox' => 'Boolean',
'ConfirmedPassword' => 'Varchar',
'CreditCard' => 'Varchar',
'Date' => 'Date',
'DateTime' => 'Datetime',
'DateTimeWithCalendar' => 'Datetime',
@ -64,8 +62,6 @@ class BasicFieldsTestPage extends TestPage
'MyLabelledFieldGroupCheckbox' => 'Boolean',
'Number' => 'Float',
'OptionSet' => 'Varchar',
'Password' => 'Varchar',
'PhoneNumber' => 'Varchar',
'Price' => 'Double',
'Readonly' => 'Varchar',
'Required' => 'Text',
@ -79,9 +75,7 @@ class BasicFieldsTestPage extends TestPage
);
private static $has_one = array(
'AttachedFile' => 'SilverStripe\\Assets\\File',
'Dropdown' => 'SilverStripe\\FrameworkTest\\Model\\TestCategory',
'File' => 'SilverStripe\\Assets\\File',
'GroupedDropdown' => 'SilverStripe\\FrameworkTest\\Model\\TestCategory',
'Image' => 'SilverStripe\\Assets\\Image',
);
@ -97,11 +91,32 @@ class BasicFieldsTestPage extends TestPage
);
private static $owns = [
'AttachedFile',
'File',
'Image',
];
private static array $scaffold_cms_fields_settings = [
'ignoreFields' => [
'MyCompositeField1',
'MyCompositeField2',
'MyCompositeField3',
'MyCompositeFieldCheckbox',
'MyFieldGroup1',
'MyFieldGroup2',
'MyFieldGroup3',
'MyFieldGroupCheckbox',
'MyLabelledFieldGroup1',
'MyLabelledFieldGroup2',
'MyLabelledFieldGroup3',
'MyLabelledFieldGroupCheckbox',
'ToggleCompositeTextField1',
'ToggleCompositeDropdownField',
],
'ignoreRelations' => [
'CheckboxSet',
'Listbox',
],
];
private static $defaults = array(
'Validated' => 2
);
@ -140,8 +155,6 @@ class BasicFieldsTestPage extends TestPage
'CalendarDate' => "2017-01-31",
'Checkbox' => 1,
// 'CheckboxSet' => null,
'ConfirmedPassword' => 'secret',
'CreditCard' => '4000400040004111',
'Date' => "2017-01-31",
'DateTime' => "2017-01-31 23:59",
'DateTimeWithCalendar' => "2017-01-31 23:59",
@ -166,8 +179,6 @@ class BasicFieldsTestPage extends TestPage
'MyLabelledFieldGroupCheckbox' => true,
'Number' => 99.123,
'OptionSet' => $thirdCat->ID,
'Password' => 'My value (ä!)',
'PhoneNumber' => '021 1235',
'Price' => 99.99,
'Readonly' => 'My value (ä!)',
'Required' => 'My required value (delete to test)',

View File

@ -3,7 +3,15 @@
use SilverStripe\ORM\DataExtension;
class FrameworkTestSiteTreeExtension extends DataExtension
{
private static $has_one = array('RelationFieldsTestPage' => 'RelationFieldsTestPage');
private static $belongs_many_many = array('RelationFieldsTestPages' => 'RelationFieldsTestPage');
private static array $scaffold_cms_fields_settings = [
'ignoreFields' => [
'RelationFieldsTestPage',
],
'ignoreRelations' => [
'RelationFieldsTestPages',
],
];
}

View File

@ -30,6 +30,16 @@ class GridFieldTestPage extends TestPage
'HasManyCompanies',
];
private static array $scaffold_cms_fields_settings = [
'ignoreFields' => [
'HasOneCompany',
],
'ignoreRelations' => [
'HasManyCompanies',
'ManyManyCompanies',
],
];
public function getCMSFields()
{
$fields = parent::getCMSFields();

View File

@ -30,6 +30,16 @@ class RelationFieldsTestPage extends TestPage
'Title' => 'Relational Fields'
);
private static array $scaffold_cms_fields_settings = [
'ignoreFields' => [
'HasOneCompany',
],
'ignoreRelations' => [
'HasManyCompanies',
'ManyManyCompanies',
],
];
public function getCMSFields()
{
$fields = parent::getCMSFields();

View File

@ -26,6 +26,12 @@ class MultiTabPage extends Page
'SettingsTabFirstField' => 'Varchar(50)',
];
private static array $scaffold_cms_fields_settings = [
'ignoreFields' => [
'SettingsTabFirstField',
],
];
public function getCMSFields()
{
$fields = parent::getCMSFields();