Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions code/BasicFieldsTestPage.php
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing a bunch of db columns that never had form fields.

Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -64,8 +62,6 @@ class BasicFieldsTestPage extends TestPage
'MyLabelledFieldGroupCheckbox' => 'Boolean',
'Number' => 'Float',
'OptionSet' => 'Varchar',
'Password' => 'Varchar',
'PhoneNumber' => 'Varchar',
'Price' => 'Double',
'Readonly' => 'Varchar',
'Required' => 'Text',
Expand All @@ -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',
);
Expand All @@ -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
);
Expand Down Expand Up @@ -140,8 +155,6 @@ public function getDefaultData()
'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",
Expand All @@ -166,8 +179,6 @@ public function getDefaultData()
'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)',
Expand Down
10 changes: 9 additions & 1 deletion code/FrameworkTestSiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
];
}
10 changes: 10 additions & 0 deletions code/GridFieldTestPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 10 additions & 0 deletions code/RelationFieldsTestPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions code/multitab-validation/MultiTabPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down