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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Overwriting SearchForm in ModelAdmin_CollectionController


Go to End


3 Posts   1365 Views

Avatar
bueckl

Community Member, 3 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, 1899 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, 3 Posts

28 May 2011 at 12:17am

Hi swaiba,

Got it. Thanks for the hint!