\Constraint_dimension
Constraint_Dimension Constrain an image field to have the specified dimension(s)
Synopsis
class Constraint_dimension
extends ZenValidatorConstraint
{
- // constants
- const WIDTH = 'width';
- const HEIGHT = 'height';
- const WIDTH_HEIGHT = 'width_height';
- const RATIO = 'ratio';
- const MIN_WIDTH = 'min_width';
- const MIN_HEIGHT = 'min_height';
- const MIN_WIDTH_HEIGHT = 'min_width_height';
- const MAX_WIDTH = 'max_width';
- const MAX_HEIGHT = 'max_height';
- const MAX_WIDTH_HEIGHT = 'max_width_height';
- // Inherited members from ZenValidatorConstraint
- protected FormField $field;
- protected $customMessage;
- protected $parsleyApplied;
- // methods
- public void __construct()
- public boolean validate()
- public string getDefaultMessage()
- // Inherited methods from ZenValidatorConstraint
- public void __construct()
- public this setField()
- public FormField getField()
- public this setMessage()
- public string getMessage()
- public void loadExtra()
- public abstract string getDefaultMessage()
- public void applyParsley()
- public void removeParsley()
- public abstract bool validate()
- public string getConstraintName()
Hierarchy
Extends
Constants
Name | Value |
---|---|
WIDTH | 'width' |
HEIGHT | 'height' |
WIDTH_HEIGHT | 'width_height' |
RATIO | 'ratio' |
MIN_WIDTH | 'min_width' |
MIN_HEIGHT | 'min_height' |
MIN_WIDTH_HEIGHT | 'min_width_height' |
MAX_WIDTH | 'max_width' |
MAX_HEIGHT | 'max_height' |
MAX_WIDTH_HEIGHT | 'max_width_height' |
Members
protected
- $customMessage — string
- $field — SilverStripe\Forms\FormField
- $parsleyApplied — boolean
- $type — string
- $val1 — int
- $val2 — int
Methods
public
- __construct() — Constructor
- getDefaultMessage() — Gets the default message for the validator
- validate() — Validate function called for validator.
Inherited from ZenValidatorConstraint
public
- applyParsley() — Sets the html attributes required for frontend validation Subclasses should call parent::applyParsley
- getConstraintName() — Gets the name of this constraint from it's classname which should correspond to the string that parsley uses to identify a constraint type
- getDefaultMessage() — Return the default message for this constraint
- getField()
- getMessage() — Get's the message that was set on the constrctor or falls back to default
- loadExtra() — Load extra validator
- removeParsley() — Removes the html attributes required for frontend validation Subclasses should call parent::removeParsley
- setField() — Set the field this constraint is applied to
- setMessage() — Set a custom message for this constraint
- validate() — Performs php validation on the value