2002 Posts in 1422 Topics by 616 members
|Go to End|
31 October 2011 at 4:14pm Last edited: 31 October 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.
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.
31 October 2011 at 9:12pm
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?
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.
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...
|Go to Top|