Jump to content

Recommended Posts

Posted

I am using repeater matrix fields and need to add a field from those to the admin live search in the navbar. But the settings for ProcessPageSearch only allow some other fields. Not repeater fields.

I found this old posting of Ryan, but perhaps this changed again. At least, I can't see any text input field.

On 4/1/2011 at 3:59 PM, ryan said:

search fields in Modules > Process > Page Search. But went and tried it myself and see we're using a multi selection field rather than a text input. :) So I went ahead and changed it to a text input so that you can use subfields (like filefield.description) for searches. If you grab the latest commit, you should be able to configure the Page Search module to use filefield.description for admin searches.

But then I found this 

 

With code to add custom searched pages. But the code is not working as expected. Actually, it looks like it never is executed.

$wire->addHook('ProcessPageSearchLive::findCustom', function(HookEvent $event) {
  bd('This never fires');
  $data = $event->arguments(0); // array 
  $search = $event->object; // ProcesPageSearchLive 
  $group = 'Pages modified today'; // description of this type of search
  if($data['q'] === 'today') {
    $items = $event->wire()->pages->find("modified>=today, include=unpublished"); 
    foreach($items as $item) {
        $search->addResult($group, $item->title, $item->editUrl); 
    }
  }
}); 

I tested multiple hook points, but none worked. ProcessPageSearchLive::execute or ProcessPageSearchLive::findReady

Code is in /site/templates/admin.php

Using PW 3.0.243

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...