1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-27 08:35:15 +02:00
This commit is contained in:
Ryan Cramer
2023-09-07 09:39:12 -04:00
parent 7ed74281ad
commit 6df11e5e46

View File

@@ -1326,6 +1326,27 @@ class FieldtypePage extends FieldtypeMulti implements Module, ConfigurableModule
return true;
}
/**
* Return whether the given value is considered empty or not.
*
* @param Field $field
* @param mixed|Selector $value
* @return bool
*
*/
public function isEmptyValue(Field $field, $value) {
if($value instanceof Selector && $value->field === $field->name) {
// PageFinder is asking if we want to handle this field/value match internally
if($value->operator === '!=' && !empty("$value->value") && !ctype_digit("$value->value")) {
// if a page name (rather than id) is specified with a `!=` operator
// then tell PageFinder that we handle this unique match condition internally
// since the page name has to be converted to page ID by getMatchQuery()
return true;
}
}
return parent::isEmptyValue($field, $value);
}
/**
* Return the database schema in predefined format
*