Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » DataObject Fields in Tab

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

Page: 1
Go to End
Author Topic: 1037 Views
  • joern
    Avatar
    Community Member
    28 Posts

    DataObject Fields in Tab Link to this post

    Hi,
    I am working on an extension of GoogleMapSelectableField, which manages this in a DataObject.
    Currently it is so that it establishes a $has_one-relationship and thus receives a new tab. This also works great, but will not save the data.
    Here are parts of the codes:

    Page with Location:

    class geoPage extends Page
    { …
       static $has_one = array(
          'Location' => 'Location'
       );
       â€¦
       public function getCMSFields()
       { …
          $location = $this->Location();
          $fields->addFieldsToTab("Root.Content.Location", $location->getCMSFields() );
       }
    }

    Location DataObject:

    class Location extends DataObject
    {
       function getCMSFields()
       {
          $fields = parent::getCMSFields();
          $fields = $this->scaffoldFormFields(array(
             'fieldClasses' => array(
                'Lat'                     => 'HiddenField'
                ,'Lng'                  => 'HiddenField'
                ,'Zoom'                  => 'HiddenField'
                ,'FormatedAddress'            => 'GoogleMapSelectableField'
                â€¦
             )
          ));
          return $fields;
       }

    When I mount it so I also receive among my fields, a dropdown box with all geoPages.
    But I get no connection between the Page and the Location.

    I hope you can help me
    Jörn

    I forgot: I use silverstripe 2.4 beta

    Edit: add Image & beta info

    Attached Files
    1037 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.