I must be missing something simple...I'm using the documentation here: http://api.silverstripe.org/en/master/class-SilverStripe.Forms.TreeDropdownField.html and I think I'm doing this correctly, but getting the error : SourceObject must be a DataObject subclass
This is my code
<?php
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\TextareaField;
class HomePage extends Page {
private static $db = array(
'CTA' => 'Varchar(255)',
'LinkText' => 'Varchar(50)'
);
private static $has_one = array(
'PageLink' => 'SiteTree'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', TextareaField::create('CTA', 'Call To Action Text'), 'Content');
$fields->addFieldToTab('Root.Main', TreeDropdownField::create('PageLinkID', 'What page does this call-to-action link to?', 'SiteTree'), 'Content');
$fields->addFieldToTab('Root.Main', TextField::create('PageLinkText', 'Call To Action Link Text (Example: "Learn more")'), 'Content');
$fields->removeByName('Content');
return $fields;
}
}