hi
i don't know how to explain so i will say everything from start:
polish => english translation:
Obiekty > Object
Strona > Page
my ObcjecPage.php to adding objects
class ObiektyPage extends Strona {
static $db = array(
'Text' => 'text',
'Lat' => 'Varchar(50)',
'Lng' => 'Varchar(50)'
);
static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new TextareaField("Text", "Text:",4),"Content");
$fields->addFieldToTab("Root.Content.coordinates", new TextField("Lat", "Lat:"));
$fields->addFieldToTab("Root.Content.coordinates", new TextField("Lng", "Lng:"));
return $fields;
}
}
class ObiektyPage_Controller extends Strona_Controller {
}
my DataObjectManager
class Obiekty extends DataObject
{
static $db = array (
'Nazwa' => 'Text',
'Obiekt' => 'Text'
);
static $has_one = array (
'TrasyPage' => 'TrasyPage'
);
public function getCMSFields_forPopup() {
$stuff = DataObject::get("ObiektyPage");
$map = $stuff? $stuff->toDropdownMap():array();
return new FieldSet(
new TextField('Nazwa'),
new DropdownField('Obiekt','Obiekt',$map)
);
}
}
and now when i add Object to the TrasaPage by DropdownField i also want to get coordinates $Lat and $Lng of chosed object but i don't know how