mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 09:06:02 +00:00
ENHANCEMENT Added readonly/disabled fields
This commit is contained in:
parent
42ffea6317
commit
e8433ba258
@ -92,13 +92,10 @@ class BasicFieldsTestPage extends TestPage {
|
|||||||
$fields->addFieldsToTab('Root.DateTime', array(
|
$fields->addFieldsToTab('Root.DateTime', array(
|
||||||
$calendarDateField = new DateField('CalendarDate','DateField with calendar'),
|
$calendarDateField = new DateField('CalendarDate','DateField with calendar'),
|
||||||
new DateField('Date','DateField'),
|
new DateField('Date','DateField'),
|
||||||
new DateField_Disabled("DateDisabled","DateField (disabled)"),
|
|
||||||
$dmyDateField = new DateField('DMYDate','DateField with separate fields'),
|
$dmyDateField = new DateField('DMYDate','DateField with separate fields'),
|
||||||
new TimeField('Time','TimeField'),
|
new TimeField('Time','TimeField'),
|
||||||
new TimeField_Readonly('TimeDisabled','TimeField (disabled)'),
|
|
||||||
$timeFieldDropdown = new TimeField('TimeDropdown','TimeField with dropdown'),
|
$timeFieldDropdown = new TimeField('TimeDropdown','TimeField with dropdown'),
|
||||||
new DatetimeField('DateTime', 'DateTime'),
|
new DatetimeField('DateTime', 'DateTime'),
|
||||||
new DatetimeField_Readonly('DateTimeDisabled', 'DateTime (disabled)'),
|
|
||||||
$dateTimeShowCalendar = new DatetimeField('DateTimeWithCalendar', 'DateTime with calendar')
|
$dateTimeShowCalendar = new DatetimeField('DateTimeWithCalendar', 'DateTime with calendar')
|
||||||
));
|
));
|
||||||
$calendarDateField->setConfig('showcalendar', true);
|
$calendarDateField->setConfig('showcalendar', true);
|
||||||
@ -114,6 +111,22 @@ class BasicFieldsTestPage extends TestPage {
|
|||||||
FormField::create('UploadField', 'ManyManyFiles','ManyManyFilesUploadField')
|
FormField::create('UploadField', 'ManyManyFiles','ManyManyFilesUploadField')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File');
|
||||||
|
foreach($tabs as $tab) {
|
||||||
|
$tabObj = $fields->fieldByName($tab);
|
||||||
|
foreach($tabObj->FieldList() as $field) {
|
||||||
|
$disabledField = $field->performDisabledTransformation();
|
||||||
|
$disabledField->setTitle($disabledField->Title() . ' (disabled)');
|
||||||
|
$disabledField->setName($disabledField->Name() . '_disabled');
|
||||||
|
$tabObj->insertAfter($disabledField, $field->Name());
|
||||||
|
|
||||||
|
$readonlyField = $field->performReadonlyTransformation();
|
||||||
|
$readonlyField->setTitle($readonlyField->Title() . ' (readonly)');
|
||||||
|
$readonlyField->setName($readonlyField->Name() . '_readonly');
|
||||||
|
$tabObj->insertAfter($readonlyField, $field->Name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user