Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Embargo/Expiry module and site search results

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 874 Views
  • Bert
    Avatar
    Community Member
    19 Posts

    Embargo/Expiry module and site search results Link to this post

    Is it possible to remove pages that should not be shown (defined by the Embargo/Expiry module) from the site search results? I tried the following, but I am still getting pages that should not be shown:

    function results($data, $form)
    {
       $results = $form->getResults();
       
       foreach ($results as $result)
       {
          if ($result->Embargo != NULL && $result->Embargo < strftime('now'))
          {
             $results->remove($result);
          }
          
          if ($result->Expiry != NULL && $result->Expiry >= strftime('now'))
          {
             $results->remove($result);
          }
       }

       $data = array(
          'Results' => $results,
          'Query' => $form->getSearchQuery(),
          'Title' => 'Search Results'
       );

       return $this->customise($data)->renderWith(array('Page_results', 'Page'));
    }

  • Bert
    Avatar
    Community Member
    19 Posts

    Re: Embargo/Expiry module and site search results Link to this post

    No one knows how I can use extra fields in the site search? The Embargo and Expiry fields seem to be accessible, but they are returned empty.

    874 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.