diff --git a/code/Form/UserFormsRequiredFields.php b/code/Form/UserFormsRequiredFields.php index 79356f5..70b13ff 100644 --- a/code/Form/UserFormsRequiredFields.php +++ b/code/Form/UserFormsRequiredFields.php @@ -134,21 +134,17 @@ class UserFormsRequiredFields extends RequiredFields $errorMessage = _t( 'SilverStripe\\Forms\\Form.FIELDISREQUIRED', '{name} is required', - array( + [ 'name' => strip_tags( '"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"' ) - ) + ] ); if ($msg = $formField->getCustomValidationMessage()) { $errorMessage = $msg; } - $this->validationError( - $fieldName, - $errorMessage, - "required" - ); + $this->validationError($fieldName, $errorMessage, "required"); } } diff --git a/code/Model/EditableCustomRule.php b/code/Model/EditableCustomRule.php index 7778455..c2fd544 100644 --- a/code/Model/EditableCustomRule.php +++ b/code/Model/EditableCustomRule.php @@ -25,24 +25,24 @@ use SilverStripe\Versioned\Versioned; class EditableCustomRule extends DataObject { private static $condition_options = [ - 'IsBlank' => 'Is blank', - 'IsNotBlank' => 'Is not blank', - 'HasValue' => 'Equals', - 'ValueNot' => 'Doesn\'t equal', - 'ValueLessThan' => 'Less than', - 'ValueLessThanEqual' => 'Less than or equal', - 'ValueGreaterThan' => 'Greater than', + 'IsBlank' => 'Is blank', + 'IsNotBlank' => 'Is not blank', + 'HasValue' => 'Equals', + 'ValueNot' => 'Doesn\'t equal', + 'ValueLessThan' => 'Less than', + 'ValueLessThanEqual' => 'Less than or equal', + 'ValueGreaterThan' => 'Greater than', 'ValueGreaterThanEqual' => 'Greater than or equal' ]; private static $db = [ - 'Display' => 'Enum("Show,Hide")', + 'Display' => 'Enum("Show,Hide")', 'ConditionOption' => 'Enum("IsBlank,IsNotBlank,HasValue,ValueNot,ValueLessThan,ValueLessThanEqual,ValueGreaterThan,ValueGreaterThanEqual")', - 'FieldValue' => 'Varchar(255)' + 'FieldValue' => 'Varchar(255)' ]; private static $has_one = [ - 'Parent' => EditableFormField::class, + 'Parent' => EditableFormField::class, 'ConditionField' => EditableFormField::class ]; @@ -240,7 +240,7 @@ class EditableCustomRule extends DataObject * @return boolean * @throws LogicException Invalid ConditionOption is set for this rule. */ - public function validateAgainstFormData($data) + public function validateAgainstFormData(array $data) { $controllingField = $this->ConditionField();