Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Overwriting SearchForm in ModelAdmin_CollectionController


Reply

3 Posts   662 Views

Avatar
bueckl

27 May 2011 at 10:19pm Community Member, 2 Posts

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!

Avatar
swaiba

27 May 2011 at 11:21pm (Last edited: 27 May 2011 11:31pm), Forum Moderator, 1796 Posts

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;
}

Avatar
bueckl

28 May 2011 at 12:17am Community Member, 2 Posts

Hi swaiba,

Got it. Thanks for the hint!