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:

Form Questions /

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

What does updateFrontEndFields(...) do?

Go to End

5 Posts   914 Views


Community Member, 166 Posts

31 October 2011 at 4:14pm

Edited: 31/10/2011 5:40pm


I have a reasonable idea what updateCMSFields does - updates (ie adds/removes) fields from the CMS.

According to the comments in updateFrontEndFields() (line 175 of DataDecoratorObject.php) performs a similar method for front end forms.

But when and how is it used? I'm trying to find some real-word examples that demonstrate its usefulness...

Eg. Line 36 of Geocodable.php. What is purpose of calling updateCMSFields() here? Having set a breakpoint on this method and debugging an instance using Addressable/Geocodable, it doesn't seem to hit this breakpoint?

Really appreciate your help.



Forum Moderator, 5523 Posts

31 October 2011 at 8:09pm

updateFrontEndFields seems like it was a half baked implementation, all the modules I've seen refer to the front end differently so you'll find your mileage using that will vary. I guess the module is trying to conform to the DataObjectDecorator interface by including support for it. If you want to make your own custom signup form then in the front end you could use it like $fields = $member->getFrontEndFields() which'll pickup all the fields in extensions attached to Member.


Community Member, 166 Posts

31 October 2011 at 9:12pm

Hi Will,

Thanks very much for your response.

I can see how it could be useful.

In what sense do you reckon it's half-baked though? Is there a more common approach for extending front end forms?

Thanks again.


Community Member, 244 Posts

31 October 2011 at 9:22pm

The getFrontEndFields fields method is actually just a counterpart to the getCMSFields method - just without the tabbed interface and other CMS-centric things. Although it's not used out of the box I personally use it quite extensively when creating forms in the front end. The updateCMSFields and updateFrontEndFields methods are used so extensions can modify the CMS or front end form fields for editing an object. The reason I called one inside the other in this case is because they both do the same thing, and i didn't want to repeat the code.


Community Member, 166 Posts

1 November 2011 at 1:29am

@ ajshort, Thanks very much for your response Andrew.

So you use updateCMSFields/updateFrontEndFields as good practise...

So in this instance, you didn't want either Lat/Lng to be visible in the CMS or on Front End Forms? But why would you explicitly need to remove them, even though you're not adding them to the CMS/Front End forms at all?

Thanks for taking the time to explain...