I'm having the same problem, the field isn't saving back to the database. I can't get the link from my template and the field shows Choose a page rather than the page I selected.
The code I'm using is:
class Module extends Page {
static $db = array(
);
static $has_one = array(
'Photo' => 'Image',
'Header' => 'Image',
'LinkedPage' => 'SiteTree'
);
static $defaults = array(
"ShowInMenus" => 0,
);
static $can_be_root = false;
static $default_parent = 'HomePage';
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new ImageField('Header'));
$fields->addFieldToTab("Root.Content.Main", new ImageField('Photo'));
$fields->addFieldToTab('Root.Content.Main', new TreeDropdownField('LinkedPage', 'Page to link to', 'SiteTree'));
$fields->removeFieldFromTab('Root.Content.Main', 'MenuTitle');
$fields->removeByName('Metadata');
return $fields;
}
}
and in the template
$LinkedPage.Link
Am I doing something wrong or is this a bug?
Cheers,
James Bench