1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-16 03:34:33 +02:00

Minor updates Selector, Selectors, Sanitizer

This commit is contained in:
Ryan Cramer
2020-06-19 12:59:39 -04:00
parent c9c06f833a
commit 7efb9e8a4b
3 changed files with 19 additions and 3 deletions

View File

@@ -4381,6 +4381,7 @@ class Sanitizer extends Wire {
'fieldName', 'fieldName',
'fieldSubfield', 'fieldSubfield',
'filename', 'filename',
'flatArray',
'float', 'float',
'httpUrl', 'httpUrl',
'hyphenCase', 'hyphenCase',
@@ -4428,6 +4429,7 @@ class Sanitizer extends Wire {
'valid', 'valid',
'validate', 'validate',
'varName', 'varName',
'wordsArray',
); );
$results = array(); $results = array();
foreach($sanitizers as $method) { foreach($sanitizers as $method) {

View File

@@ -403,7 +403,7 @@ abstract class Selector extends WireData {
} }
/** /**
* Get label that describes this Selector * Get short label that describes this Selector
* *
* @return string * @return string
* @since 3.0.160 * @since 3.0.160
@@ -412,6 +412,17 @@ abstract class Selector extends WireData {
public static function getLabel() { public static function getLabel() {
return ''; return '';
} }
/**
* Get longer description that describes this Selector
*
* @return string
* @since 3.0.160
*
*/
public static function getDescription() {
return '';
}
/** /**
* Does $value1 match $value2? * Does $value1 match $value2?

View File

@@ -1176,8 +1176,8 @@ class Selectors extends WireArray {
* - `operator` (string): Return info for only this operator. When specified, only value is returned (default=''). * - `operator` (string): Return info for only this operator. When specified, only value is returned (default='').
* - `compareType` (int): Return only operators matching given `Selector::compareType*` constant (default=0). * - `compareType` (int): Return only operators matching given `Selector::compareType*` constant (default=0).
* - `getIndexType` (string): Index type to use in returned array: 'operator', 'className' or 'class' (default='class') * - `getIndexType` (string): Index type to use in returned array: 'operator', 'className' or 'class' (default='class')
* - `getValueType` (string): Value type to use in returned array: 'operator', 'class', 'className', 'label', 'compareType', 'verbose' (default='operator'). * - `getValueType` (string): Value type to use in returned array: 'operator', 'class', 'className', 'label', 'description', 'compareType', 'verbose' (default='operator').
* If 'verbose' option used then assoc array returned for each operator containing 'class', 'className', 'operator', 'compareType', 'label'. * If 'verbose' option used then assoc array returned for each operator containing 'class', 'className', 'operator', 'compareType', 'label', 'description'.
* @return array|string|int Returned array where both keys and values are operators (or values are requested 'valueType' option) * @return array|string|int Returned array where both keys and values are operators (or values are requested 'valueType' option)
* If 'operator' option specified, return value is string, int or array (requested 'valueType'), and there is no indexType. * If 'operator' option specified, return value is string, int or array (requested 'valueType'), and there is no indexType.
* @since 3.0.154 * @since 3.0.154
@@ -1215,6 +1215,8 @@ class Selectors extends WireArray {
$value = $className; $value = $className;
} else if($valueType === 'label') { } else if($valueType === 'label') {
$value = $className::getLabel(); $value = $className::getLabel();
} else if($valueType === 'description') {
$value = $className::getDescription();
} else if($valueType === 'compareType') { } else if($valueType === 'compareType') {
$value = $className::getCompareType(); $value = $className::getCompareType();
} else if($valueType === 'verbose') { } else if($valueType === 'verbose') {
@@ -1224,6 +1226,7 @@ class Selectors extends WireArray {
'className' => $className, 'className' => $className,
'compareType' => $className::getCompareType(), 'compareType' => $className::getCompareType(),
'label' => $className::getLabel(), 'label' => $className::getLabel(),
'description' => $className::getDescription(),
); );
} else { } else {
$value = $operator; $value = $operator;