Hi Team,
Here is my situation.
I have created a class HostelPage where I want to link in a single value for lattitude/longitude within the LatLng class. That value needs to be set via the HostelPage within the cms admin. I want the lattitude/longitude data to be loaded into and set from a hidden field. I will set the hidden field value via an interactive map loaded in by javascript.
So far I have a HostelPage class extending the Page class. Within that class I have put in a has_one relationship to LatLng:
static $has_one = array(
'LatLng' => 'LatLng'
)
Within the getCMSFields() function of the HostelPage class I have inserted:
$fields->addFieldToTab("Root.Content.Map", new LatLngField('LatLngString'), 'LatLng');
Within my LatLngField Class I set up functionality to return a hidden field and then update that value via javascript.
I have created a LatLng class like this:
class LatLng extends DataObject {
static $db = array(
'LatLngString' => 'Text'
);
}
This is not working. I am unsure of the has_one relationship or if I need to use something else; about whether I need belongs_many_many within the LatLng class; and whether I need to do an explicit DataObject::get() to retrieve the LatLngString.
Any help would be most appreciated.
Thanks,
Davis