diff --git a/wire/modules/Process/ProcessPageSearch/ProcessPageSearchLive.php b/wire/modules/Process/ProcessPageSearch/ProcessPageSearchLive.php index 5c9f59d2..1fecb7da 100644 --- a/wire/modules/Process/ProcessPageSearch/ProcessPageSearchLive.php +++ b/wire/modules/Process/ProcessPageSearch/ProcessPageSearchLive.php @@ -7,6 +7,7 @@ * @method renderItem(array $item, $prefix = 'pw-search', $class = 'list') * @method string|array execute($getJSON = true) * @method bool findCustom(array $data) + * @method array getDefaultPageSearchFields() * * @todo support searching repeaters * @@ -380,7 +381,7 @@ class ProcessPageSearchLive extends Wire { $selectors[] = $property . $operator . $value; } else { // we did not recognize the property, so use field(s) defined in module instead - $selectors[] = implode('|', $this->defaultPageSearchFields) . $operator . $value; + $selectors[] = implode('|', $this->getDefaultPageSearchFields()) . $operator . $value; } $help = strtolower($q) === 'help'; @@ -1326,4 +1327,26 @@ class ProcessPageSearchLive extends Wire { return true; } + /** + * Get the names of fields that should be used when searching pages + * + * Hook this from /site/templates/admin.php to modify what gets searched. + * This overrides the setting specified interactively in the ProcessPageSearch module settings. + * + * ~~~~~ + * $wire->addHookAfter('ProcessPageSearchLive::getDefaultPageSearchFields', function(HookEvent $e) { + * $e->return = [ 'title', 'subtitle', 'categories.title' ]; + * }); + * ~~~~~ + * + * #pw-hooker + * + * @return array + * @since 3.0.242 + * + */ + public function ___getDefaultPageSearchFields() { + return $this->defaultPageSearchFields; + } + }