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   703 Views

Avatar
bueckl

Community Member, 2 Posts

27 May 2011 at 10:19pm

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

Forum Moderator, 1805 Posts

27 May 2011 at 11:21pm

Edited: 27/05/2011 11:31pm

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

Community Member, 2 Posts

28 May 2011 at 12:17am

Hi swaiba,

Got it. Thanks for the hint!