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

API Rename method #209

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
10 changes: 5 additions & 5 deletions code/BasicFieldsTestPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class BasicFieldsTestPage extends TestPage
'Money' => 'Money',
'MyCompositeField1' => 'Varchar',
'MyCompositeField2' => 'Varchar',
'MyCompositeField3' => 'Varchar',
'MyCompositeField3' => 'Int',
'MyCompositeFieldCheckbox' => 'Boolean',
'MyFieldGroup1' => 'Varchar',
'MyFieldGroup2' => 'Varchar',
'MyFieldGroup3' => 'Varchar',
'MyFieldGroup3' => 'Int',
'MyFieldGroupCheckbox' => 'Boolean',
'MyLabelledFieldGroup1' => 'Varchar',
'MyLabelledFieldGroup2' => 'Varchar',
Expand All @@ -70,7 +70,7 @@ class BasicFieldsTestPage extends TestPage
'Time' => 'Time',
'TimeHTML5' => 'Time',
'ToggleCompositeTextField1' => 'Varchar',
'ToggleCompositeDropdownField' => 'Varchar',
'ToggleCompositeDropdownField' => 'Int',
'Validated' => 'Int',
);

Expand Down Expand Up @@ -323,13 +323,13 @@ public function getCMSFields()
$disabledField = $field->performDisabledTransformation();
$disabledField->setTitle($disabledField->Title() . ' (disabled)');
$disabledField->setName($disabledField->getName() . '_disabled');
$disabledField->setValue($this->getField($field->getName()));
$disabledField->setValue($field->getValue());
$tabObj->insertAfter($field->getName(), $disabledField);

$readonlyField = $field->performReadonlyTransformation();
$readonlyField->setTitle($readonlyField->Title() . ' (readonly)');
$readonlyField->setName($readonlyField->getName() . '_readonly');
$readonlyField->setValue($this->getField($field->getName()));
$readonlyField->setValue($field->getValue());
$tabObj->insertAfter($field->getName(), $readonlyField);
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/elemental/ElementContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ElementContentExtension extends Extension
'MyFile' => File::class,
];

protected function updatevalidate(ValidationResult $result)
protected function updateValidate(ValidationResult $result)
{
if ($this->owner->Title == 'x') {
$result->addFieldError('Title', 'Title cannot be x');
Expand Down
5 changes: 3 additions & 2 deletions code/elemental/NumericFieldExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

use SilverStripe\Forms\NumericField;
use SilverStripe\Core\Extension;
use SilverStripe\Core\Validation\ValidationResult;

/**
* @extends Extension<NumericField>
*/
class NumericFieldExtension extends Extension
{
protected function updateValidationResult($result, $validator)
protected function updateValidate(ValidationResult $result)
{
if ($this->owner->Value() == 1) {
$validator->validationError($this->owner->getName(), 'This field cannot be 1');
$result->addFieldError($this->owner->getName(), 'This field cannot be 1');
}
}
}