1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 10:15:28 +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',
'fieldSubfield',
'filename',
'flatArray',
'float',
'httpUrl',
'hyphenCase',
@@ -4428,6 +4429,7 @@ class Sanitizer extends Wire {
'valid',
'validate',
'varName',
'wordsArray',
);
$results = array();
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
* @since 3.0.160
@@ -412,6 +412,17 @@ abstract class Selector extends WireData {
public static function getLabel() {
return '';
}
/**
* Get longer description that describes this Selector
*
* @return string
* @since 3.0.160
*
*/
public static function getDescription() {
return '';
}
/**
* 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='').
* - `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')
* - `getValueType` (string): Value type to use in returned array: 'operator', 'class', 'className', 'label', 'compareType', 'verbose' (default='operator').
* If 'verbose' option used then assoc array returned for each operator containing 'class', 'className', 'operator', 'compareType', 'label'.
* - `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', 'description'.
* @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.
* @since 3.0.154
@@ -1215,6 +1215,8 @@ class Selectors extends WireArray {
$value = $className;
} else if($valueType === 'label') {
$value = $className::getLabel();
} else if($valueType === 'description') {
$value = $className::getDescription();
} else if($valueType === 'compareType') {
$value = $className::getCompareType();
} else if($valueType === 'verbose') {
@@ -1224,6 +1226,7 @@ class Selectors extends WireArray {
'className' => $className,
'compareType' => $className::getCompareType(),
'label' => $className::getLabel(),
'description' => $className::getDescription(),
);
} else {
$value = $operator;