From 09300ebb964718fe72bb9dccab72a1c9c0cc2d39 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 2 Aug 2023 10:14:46 -0400 Subject: [PATCH] Update PagesLoader::count() method to fully support selectors argument that is instanceof Selectors object --- wire/core/PagesLoader.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wire/core/PagesLoader.php b/wire/core/PagesLoader.php index 40b76e4c..b68d2b9c 100644 --- a/wire/core/PagesLoader.php +++ b/wire/core/PagesLoader.php @@ -1988,7 +1988,7 @@ class PagesLoader extends Wire { /** * Count and return how many pages will match the given selector string * - * @param string|array $selector Specify selector, or omit to retrieve a site-wide count. + * @param string|array|Selectors $selector Specify selector, or omit to retrieve a site-wide count. * @param array|string $options See $options in Pages::find * @return int * @@ -2016,6 +2016,8 @@ class PagesLoader extends Wire { $selector .= ", limit=1"; } else if(is_array($selector)) { $selector['limit'] = 1; + } else if($selector instanceof Selectors) { + $selector->add(new SelectorEqual('limit', 1)); } return $this->pages->find($selector, $options)->getTotal(); }