diff --git a/wire/modules/Fieldtype/FieldtypePage.module b/wire/modules/Fieldtype/FieldtypePage.module index e57c43dd..d4ddb89a 100644 --- a/wire/modules/Fieldtype/FieldtypePage.module +++ b/wire/modules/Fieldtype/FieldtypePage.module @@ -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 *