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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

Identify show and edit forms


Go to End


4 Posts   1306 Views

Avatar
cardinale

Community Member, 23 Posts

22 March 2010 at 9:40pm

Edited: 22/03/2010 9:42pm

How can I know if the actual form is edit or show ?

function getCMSFields() {
$fields = parent::getCMSFields();

// This is working for add form:

if( !$this->ID ) {
// form = add
// https://www.xy.de/admin/Modeladmin/Depositaer/5/EditForm/field/News/add
}

// This is NOT working for show form:

if( $this->action == 'show' ) {
// form = show
// https://www.xy.de/admin/Modeladmin/Depositaer/5/EditForm/field/News/item/12/show
}

return $fields;
}

Avatar
cardinale

Community Member, 23 Posts

26 March 2010 at 10:27pm

Hello,
I'm looking since 4 days for the solution and will be very happy if someone could help me.

Avatar
Willr

Forum Moderator, 5523 Posts

27 March 2010 at 4:04pm

Are you referring to cms fields in the site tree or in a form such as model admin?

Avatar
cardinale

Community Member, 23 Posts

27 March 2010 at 10:02pm

Thanks Willr,
my form is in the model admin!