silverstripe-vendormodule required-field-validator
Adds required field validation to dataobjects when used outside of the cms|controller|form context
silverstripe/required-field-validator
Adds required field validation to dataobjects when used outside of the cms|controller|form context
- Wednesday, January 31, 2018
- by fspringveldt
- Repository
- 1 Watchers
- 0 Stars
- 71 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 3 % Grown
SilverStripe Required field validator
This module adds a required field validation mechanism to DataObjects which can be used outside of the cms|controller|form context.
It does so by adding a hook to the DataObject::validate()
method to check for statically configured fields., (*1)
Installation
composer require silverstripe/required-field-validator
, (*2)
Configuration/Usage instructions
Required fields can be set on a DataObject subclass by adding private static $required_fields
to it as below, (*3)
Configuration example:, (*4)
class MyObject extends DataObject
{
private static $db = [
'Title' => 'Varchar(20)'
];
private static $required_fields = [
'Title'
]
}
Bugtracker
Bugs are tracked on github.com., (*5)
dev-master
9999999-dev
Adds required field validation to dataobjects when used outside of the cms|controller|form context
Sources
Download
BSD-3-Clause
The Requires
by
Franco Springveldt