Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » [solved] getCustomSearchContext not working

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

Page: 1
Go to End
Author Topic: 247 Views
  • thomas.paulson
    Community Member
    72 Posts

    [solved] getCustomSearchContext not working Link to this post

    I create the Album Dataobject, ModelAdmin as below, to manage them in cms,

    In search filter, only Name field is visible, i want to show Author also , so override the getCustomSearchContext function,

    But it does seems to be not working,

    class Album extends DataObject{
    private static $db = array(
    'Name' => 'Varchar(200)',
    'Author' => 'Varchar(200)',

    private static $has_many = array(

    public function getCustomSearchContext() {
    $fields = $this->scaffoldSearchFields(array(
    'restrictFields' => array()
    $filters = array(
    'Author' => new PartialMatchFilter('Author'),
    'Author' => new PartialMatchFilter('Author')
    return new SearchContext(


    I know we can use, $searchable_fields but I don't want to use them. because i want to customize form fields in the search form.


    thanks to http://www.3dgoo.com/

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.