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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Remove delete actions from ResultForm


Go to End


4 Posts   1702 Views

Avatar
moggen

Community Member, 2 Posts

9 December 2009 at 5:18am

Hi

I'm using the ModelAdmin class witch gives me the built in search form that works great. But when my search result shows up it also displays the delete action or the red cross. My question is simple how do I overide the ResultForm function to not display the delete action ?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

9 December 2009 at 5:58am

This is more of a ModelAdmin question that doesn't really relate to DOM, so you may get better advice in another forum.

But my guess is if the canDelete() permission is false on the objects being returned, the delete button won't show.

Avatar
moggen

Community Member, 2 Posts

9 December 2009 at 10:59pm

Ok then I know thanks for the answer any way.

Avatar
Silverfish

Community Member, 59 Posts

1 December 2011 at 12:25am

Yes, this is the way!

Either remove the delete rights on searched objet for given user or simply make the object undeletable by overwriting canDelete() like

public function canDelete() {
  return false;
}

This works for Editing (canEdit()) the same way.

Regards
SF