Hi.
I'm stuck at the following:
class MyLink extends DataObject {
public static $db = array(
"Title" => "Varchar(255)",
);
public static $has_one = array(
"ParentPage" => "SiteTree",
"PagePointer" => "SiteTree",
);
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('Title','Link title'));
$fields->push(new SimpleTreeDropdownField('PagePointerID','Select page'));
return $fields;
}
}
and on MyErrorPage :
class MyErrorPage extends ErrorPage {
public static $has_many = array(
"LinkList" => "MyLink",
);
function getCMSFields() {
$fields = parent::getCMSFields();
$manager = new DataObjectManager(
$this,
'LinkList',
'MyLink',
array(
"Title" => "Title",
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab('Root.Content.LinkList',$manager);
return $fields;
}
}
When I comment out 'PagePointer' and SimpleTreeDropdownField from 'MyLink' class, everything works perfect. I can add MyLink items in DOM and then list them in a control (at MyErrorPage):
<% control LinkList %>
<li>$Title</li>
<% end_control %>
But after adding this:
"PagePointer" => "SiteTree",
and this:
$fields->push(new SimpleTreeDropdownField('PagePointerID','Select page'));
and rebuilding the database, LinkList control stops working. It doesn't matter if I set the value of PagePointerID or not, <% control LinkList %> is just empty, not a single item being shown.
I triple checked everything, what am I missing here?