Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • AdvancedSearchForm
  • ContentControllerSearchExtension
  • EndsWithFilter
  • ExactMatchFilter
  • ExactMatchMultiFilter
  • FulltextFilter
  • FulltextSearchable
  • GreaterThanFilter
  • LessThanFilter
  • NegationFilter
  • PartialMatchFilter
  • SearchContext
  • SearchFilter
  • SearchForm
  • StartsWithFilter
  • StartsWithMultiFilter
  • SubstringFilter
  • WithinRangeFilter
 1 <?php
 2 /**
 3  * Extension to provide a search interface when applied to ContentController
 4  * 
 5  * @package sapphire
 6  * @subpackage search
 7  */
 8 class ContentControllerSearchExtension extends Extension { 
 9     static $allowed_actions = array(
10         'SearchForm',
11         'results',
12     );
13     
14     /**
15      * Site search form
16      */
17     function SearchForm() {
18         $searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
19         $fields = new FieldSet(
20             new TextField('Search', '', $searchText)
21         );
22         $actions = new FieldSet(
23             new FormAction('results', 'Search')
24         );
25         return new SearchForm($this->owner, 'SearchForm', $fields, $actions);
26     }
27 
28     /**
29      * Process and render search results.
30      * 
31      * @param array $data The raw request data submitted by user
32      * @param SearchForm $form The form instance that was submitted
33      * @param SS_HTTPRequest $request Request generated for this action
34      */
35     function results($data, $form, $request) {
36         $data = array(
37             'Results' => $form->getResults(),
38             'Query' => $form->getSearchQuery(),
39             'Title' => 'Search Results'
40         );
41         return $this->owner->customise($data)->renderWith(array('Page_results', 'Page'));
42     }
43 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0