Minor linting adjustment.

This commit is contained in:
Maxime Rainville 2020-01-14 12:28:04 +13:00
parent 39ee08cff9
commit e2c05d5a55
2 changed files with 14 additions and 18 deletions

View File

@ -134,21 +134,17 @@ class UserFormsRequiredFields extends RequiredFields
$errorMessage = _t( $errorMessage = _t(
'SilverStripe\\Forms\\Form.FIELDISREQUIRED', 'SilverStripe\\Forms\\Form.FIELDISREQUIRED',
'{name} is required', '{name} is required',
array( [
'name' => strip_tags( 'name' => strip_tags(
'"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"' '"' . ($formField->Title() ? $formField->Title() : $fieldName) . '"'
) )
) ]
); );
if ($msg = $formField->getCustomValidationMessage()) { if ($msg = $formField->getCustomValidationMessage()) {
$errorMessage = $msg; $errorMessage = $msg;
} }
$this->validationError( $this->validationError($fieldName, $errorMessage, "required");
$fieldName,
$errorMessage,
"required"
);
} }
} }

View File

@ -25,24 +25,24 @@ use SilverStripe\Versioned\Versioned;
class EditableCustomRule extends DataObject class EditableCustomRule extends DataObject
{ {
private static $condition_options = [ private static $condition_options = [
'IsBlank' => 'Is blank', 'IsBlank' => 'Is blank',
'IsNotBlank' => 'Is not blank', 'IsNotBlank' => 'Is not blank',
'HasValue' => 'Equals', 'HasValue' => 'Equals',
'ValueNot' => 'Doesn\'t equal', 'ValueNot' => 'Doesn\'t equal',
'ValueLessThan' => 'Less than', 'ValueLessThan' => 'Less than',
'ValueLessThanEqual' => 'Less than or equal', 'ValueLessThanEqual' => 'Less than or equal',
'ValueGreaterThan' => 'Greater than', 'ValueGreaterThan' => 'Greater than',
'ValueGreaterThanEqual' => 'Greater than or equal' 'ValueGreaterThanEqual' => 'Greater than or equal'
]; ];
private static $db = [ private static $db = [
'Display' => 'Enum("Show,Hide")', 'Display' => 'Enum("Show,Hide")',
'ConditionOption' => 'Enum("IsBlank,IsNotBlank,HasValue,ValueNot,ValueLessThan,ValueLessThanEqual,ValueGreaterThan,ValueGreaterThanEqual")', 'ConditionOption' => 'Enum("IsBlank,IsNotBlank,HasValue,ValueNot,ValueLessThan,ValueLessThanEqual,ValueGreaterThan,ValueGreaterThanEqual")',
'FieldValue' => 'Varchar(255)' 'FieldValue' => 'Varchar(255)'
]; ];
private static $has_one = [ private static $has_one = [
'Parent' => EditableFormField::class, 'Parent' => EditableFormField::class,
'ConditionField' => EditableFormField::class 'ConditionField' => EditableFormField::class
]; ];
@ -240,7 +240,7 @@ class EditableCustomRule extends DataObject
* @return boolean * @return boolean
* @throws LogicException Invalid ConditionOption is set for this rule. * @throws LogicException Invalid ConditionOption is set for this rule.
*/ */
public function validateAgainstFormData($data) public function validateAgainstFormData(array $data)
{ {
$controllingField = $this->ConditionField(); $controllingField = $this->ConditionField();