SilverWare\Validator\Backends\ParsleyBackend
An extension of the backend class which uses Parsley to handle form validation.
- Author: Colin Tucker <colin@praxis.net.au>
- Copyright: 2017 Praxis Interactive
- License: https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
Synopsis
class ParsleyBackend
extends Backend
{
- // members
- private static array $required_js = ;
- private static string $default_trigger_on = 'change';
- private static string $group_class = 'form-group';
- private static string $error_wrapper_class = 'invalid-feedback';
- private static string $group_error_class = 'has-invalid';
- private static string $group_success_class = 'has-valid';
- private static string $field_error_class = 'is-invalid';
- private static string $field_success_class = 'is-valid';
- protected $triggerOn;
- // Inherited members from Backend
- protected Validator $frontend;
- // methods
- public array getAttributesForForm()
- public array getAttributesForField()
- public $this setTriggerOn()
- public string getTriggerOn()
- // Inherited methods from Backend
- public void __construct()
- public $this setFrontend()
- public Validator getFrontend()
- public array getClassesForForm()
- public array getAttributesForForm()
- public array getAttributesForField()
- public string getHTMLClass()
- public void doInit()
- public string attr()
- public string prefix()
- public string getMapping()
- public boolean hasMapping()
- public array getMappings()
- public string getDefaultAttribute()
- public Rule configureRule()
- public array getRequiredJS()
- public array getRequiredCSS()
- public void loadRequirements()
- protected void init()
- protected array flatten()
- protected array getRuleConfig()
Hierarchy
Extends
Members
private
- $default_trigger_on
—
string
Defines the default events which will trigger validation. - $error_wrapper_class
—
string
Defines the class name of the error wrapper element. - $field_error_class
—
string
Defines the class name to add to the field element upon error. - $field_success_class
—
string
Defines the class name to add to the field element upon success. - $group_class
—
string
Defines the class name of the field group element. - $group_error_class
—
string
Defines the class name to add to the field group element upon error. - $group_success_class
—
string
Defines the class name to add to the field group element upon success. - $required_js
—
array
An array of required JavaScript files.
protected
- $frontend
—
SilverWare\Validator\Validator
The validator frontend associated with this backend. - $triggerOn
—
string
A string of events which will trigger validation.
Methods
public
- getAttributesForField() — Answers an array of the validator attributes for the given form field.
- getAttributesForForm() — Answers an array of the validator attributes for the given form.
- getTriggerOn() — Answers the value of the triggerOn attribute, or the default trigger.
- setTriggerOn() — Defines the value of the triggerOn attribute.
Inherited from SilverWare\Validator\Backend
protected
- flatten() — Flattens the given array of attributes.
- getRuleConfig() — Answers the configuration array for the provided rule.
- init() — Initialises the validator backend.
public
- attr() — Answers the appropriate validator attribute name for the given mapping name and arguments.
- configureRule() — Applies configuration to the provided validator rule.
- doInit() — Initialises the validator backend (with extension hooks).
- getAttributesForField() — Answers an array of the validator attributes for the given form field.
- getAttributesForForm() — Answers an array of the validator attributes for the given form.
- getClassesForForm() — Answers an array of the validator classes for the given form.
- getDefaultAttribute() — Answers the default attribute name from configuration.
- getFrontend() — Answers the value of the Frontend attribute.
- getHTMLClass() — Answers the HTML class name for the receiver.
- getMapping() — Answers the attribute mapping with the given name.
- getMappings() — Answers the configured attribute mappings for the receiver.
- getRequiredCSS() — Answers an array of CSS files required by the receiver.
- getRequiredJS() — Answers an array of JavaScript files required by the receiver.
- hasMapping() — Answers true if an attribute mapping exists with the given name.
- loadRequirements() — Loads the CSS and scripts required by the receiver.
- prefix() — Prefixes the given attribute name (if required).
- setFrontend() — Defines the value of the frontend attribute.