Jump to:

22975 Posts in 11620 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Overwriting SearchForm in ModelAdmin_CollectionController

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 588 Views
  • bueckl
    Avatar
    Community Member
    2 Posts

    Overwriting SearchForm in ModelAdmin_CollectionController Link to this post

    Hello,

    I'm new to silverstripe and playing with ModelAdmin. I'm trying to overwrite SearchForm() in my EnquiryAdmin Class. Thing is Overwriting doesn't work for me.

    class EnquiryAdmin_CollectionController extends ModelAdmin_CollectionController{

       public function SearchForm() {
          $form = parent::SearchForm();
          var_dump($form);
          die;
          return $form;
       } ...

    }

    No dump, no die :S

    What am I doing wrong?

    Thanks in advance!

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: Overwriting SearchForm in ModelAdmin_CollectionController Link to this post

    Hi bueckl,

    In ModelAdmin there is more than one search form, there is one search form per model and scaffolding is done from either the Summary_fields or the search_fields in the DataObject, to provide further customization to it you can (again within the DataObject) do this...

    public function scaffoldSearchFields() {
       $fields = parent::scaffoldSearchFields();
       var_dump($fields);
       return $fields;
    }

  • bueckl
    Avatar
    Community Member
    2 Posts

    Re: Overwriting SearchForm in ModelAdmin_CollectionController Link to this post

    Hi swaiba,

    Got it. Thanks for the hint!

    588 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.