Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct ($filterRules, $validatorRules, array $data=null, array $options=null) | |
addNamespace ($namespaces) | |
addFilterPrefixPath ($prefix, $path) | |
addValidatorPrefixPath ($prefix, $path) | |
setPluginLoader (Zend_Loader_PluginLoader_Interface $loader, $type) | |
getPluginLoader ($type) | |
getMessages () | |
getErrors () | |
getInvalid () | |
getMissing () | |
getUnknown () | |
getEscaped ($fieldName=null) | |
getUnescaped ($fieldName=null) | |
__get ($fieldName) | |
hasInvalid () | |
hasMissing () | |
hasUnknown () | |
hasValid () | |
isValid ($fieldName=null) | |
__isset ($fieldName) | |
process () | |
setData (array $data) | |
setDefaultEscapeFilter ($escapeFilter) | |
setOptions (array $options) | |
setTranslator ($translator=null) | |
getTranslator () | |
setDisableTranslator ($flag) | |
translatorIsDisabled () | |
Data Fields | |
const | ALLOW_EMPTY = 'allowEmpty' |
const | BREAK_CHAIN = 'breakChainOnFailure' |
const | DEFAULT_VALUE = 'default' |
const | MESSAGES = 'messages' |
const | ESCAPE_FILTER = 'escapeFilter' |
const | FIELDS = 'fields' |
const | FILTER = 'filter' |
const | FILTER_CHAIN = 'filterChain' |
const | MISSING_MESSAGE = 'missingMessage' |
const | INPUT_NAMESPACE = 'inputNamespace' |
const | VALIDATOR_NAMESPACE = 'validatorNamespace' |
const | FILTER_NAMESPACE = 'filterNamespace' |
const | NOT_EMPTY_MESSAGE = 'notEmptyMessage' |
const | PRESENCE = 'presence' |
const | PRESENCE_OPTIONAL = 'optional' |
const | PRESENCE_REQUIRED = 'required' |
const | RULE = 'rule' |
const | RULE_WILDCARD = '*' |
const | VALIDATE = 'validate' |
const | VALIDATOR = 'validator' |
const | VALIDATOR_CHAIN = 'validatorChain' |
const | VALIDATOR_CHAIN_COUNT = 'validatorChainCount' |
Protected Member Functions | |
_escapeRecursive ($data) | |
_filter () | |
_filterRule (array $filterRule) | |
_getDefaultEscapeFilter () | |
_getMissingMessage ($rule, $field) | |
_getNotEmptyMessage ($rule, $field) | |
_process () | |
_validate () | |
_validateRule (array $validatorRule) | |
_getNotEmptyValidatorInstance ($validatorRule) | |
_getFilter ($classBaseName) | |
_getValidator ($classBaseName) | |
_getFilterOrValidator ($type, $classBaseName) | |
Protected Attributes | |
$_data = array() | |
$_filterRules = array() | |
$_validatorRules = array() | |
$_validFields = array() | |
$_invalidMessages = array() | |
$_invalidErrors = array() | |
$_missingFields = array() | |
$_unknownFields = array() | |
$_defaultEscapeFilter = null | |
$_loaders = array() | |
$_defaults | |
$_processed = false | |
$_translator | |
$_translatorDisabled = false | |
__construct | ( | $filterRules, | |
$validatorRules, | |||
array | $data = null , |
||
array | $options = null |
||
) |
__get | ( | $fieldName | ) |
__isset | ( | $fieldName | ) |
|
protected |
|
protected |
Make sure we have an array representing this filter chain. Don't typecast to (array) because it might be a Zend_Filter object
Filters are indexed by integer, metacommands are indexed by string. Pick out the filters.
Use defaults for filter metacommands.
Load all the filter classes and add them to the chain.
If the ruleName is the special wildcard rule, then apply the filter chain to all input data. Else just process the field named by the rule.
Definition at line 648 of file Input.php.
|
protected |
|
protected |
Definition at line 729 of file Input.php.
|
protected |
mixed | $classBaseName |
Definition at line 1161 of file Input.php.
|
protected |
string | $type | |
mixed | $classBaseName |
Zend_Filter_Exception |
Definition at line 1181 of file Input.php.
|
protected |
|
protected |
|
protected |
Check a validatorRule for the presence of a NotEmpty validator instance. The purpose is to preserve things like a custom message, that may have been set on the validator outside Zend_Filter_Input.
array | $validatorRule |
Definition at line 1147 of file Input.php.
|
protected |
mixed | $classBaseName |
Definition at line 1170 of file Input.php.
|
protected |
Special case: if there are no validators, treat all fields as valid.
Make sure we have an array representing this validator chain. Don't typecast to (array) because it might be a Zend_Validate object
Validators are indexed by integer, metacommands are indexed by string. Pick out the validators.
Use defaults for validation metacommands.
Load all the validator classes and add them to the chain.
we are changing the defaults here, this is alright if all subsequent validators are also a not empty validator, but it goes wrong if one of them is not AND is required!!! that is why we restore the default value at the end of this loop
If the ruleName is the special wildcard rule, then apply the validator chain to all input data. Else just process the field named by the rule.
Unset fields in $_data that have been added to other arrays. We have to wait until all rules have been processed because a given field may be referenced by multiple rules.
Anything left over in $_data is an unknown field.
Definition at line 794 of file Input.php.
|
protected |
array | $validatorRule |
Get one or more data values from input, and check for missing fields. Apply defaults if fields are missing.
If any required fields are missing, break the loop.
Evaluate the inputs against the validator chain.
If we got this far, the inputs for this rule pass validation.
Definition at line 985 of file Input.php.
addFilterPrefixPath | ( | $prefix, | |
$path | |||
) |
Add prefix path for all elements
string | $prefix | |
string | $path |
Definition at line 207 of file Input.php.
addNamespace | ( | $namespaces | ) |
mixed | $namespaces |
Definition at line 184 of file Input.php.
addValidatorPrefixPath | ( | $prefix, | |
$path | |||
) |
Add prefix path for all elements
string | $prefix | |
string | $path |
Definition at line 221 of file Input.php.
getEscaped | ( | $fieldName = null | ) |
getPluginLoader | ( | $type | ) |
Retrieve plugin loader for given type
$type may be one of:
If a plugin loader does not exist for the given type, defaults are created.
string | $type | 'filter' or 'validate' |
Zend_Filter_Exception | on invalid type |
Definition at line 266 of file Input.php.
getTranslator | ( | ) |
Return translation object
Definition at line 598 of file Input.php.
getUnescaped | ( | $fieldName = null | ) |
isValid | ( | $fieldName = null | ) |
process | ( | ) |
Zend_Filter_Exception |
Definition at line 463 of file Input.php.
setData | ( | array | $data | ) |
array | $data |
Reset to initial state
Definition at line 482 of file Input.php.
setDefaultEscapeFilter | ( | $escapeFilter | ) |
mixed | $escapeFilter |
Definition at line 504 of file Input.php.
setDisableTranslator | ( | $flag | ) |
Indicate whether or not translation should be disabled
bool | $flag |
setOptions | ( | array | $options | ) |
array | $options |
Zend_Filter_Exception | if an unknown option is given |
Definition at line 522 of file Input.php.
setPluginLoader | ( | Zend_Loader_PluginLoader_Interface | $loader, |
$type | |||
) |
Set plugin loaders for use with decorators and elements
Zend_Loader_PluginLoader_Interface | $loader | |
string | $type | 'filter' or 'validate' |
Zend_Filter_Exception | on invalid type |
Definition at line 236 of file Input.php.
setTranslator | ( | $translator = null | ) |
Set translation object
Zend_Translate | Zend_Translate_Adapter | null | $translator |
Definition at line 579 of file Input.php.
translatorIsDisabled | ( | ) |
|
protected |