Can anyone see if maybe I am missing something. My luck a comma!
I get the following error when trying to include a site treet drop down in my File DOM.
[User Error] Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'SiteTree'
GET /admin
Line 724 in /home/content/28/4118128/html/sapphire/core/Object.php
THANKS!
GOLDSPONSOR.PHP
<?php
class GoldSponsor extends DataObject
{
static $db = array (
'CompanyName' => 'Text',
'CompanyWebAddress' => 'Text'
);
static $has_one = array (
'Attachment' => 'File',
'GoldSponsorPage' => 'GoldSponsorPage'
'GoldRelatedArticle' => 'SiteTree',
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('CompanyName'),
new TextField('CompanyWebAddress'),
new SimpleTreeDropdownField('GoldRelatedArticleID', "Related Page", 'SiteTree'),
new FileIFrameField('Attachment')
);
}
}
?>
GOLDSPONSORPAGE.PHP
<?php
class GoldSponsorPage extends RightNav
{
static $has_many = array (
'GoldSponsors' => 'GoldSponsor'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'GoldSponsors', // Source name
'GoldSponsor', // Source class
'Attachment', // File name on DataObject
array(
'CompanyName' => 'CompanyName',
'CompanyWebAddress' => 'CompanyWebAddress',
'GoldRelatedArticle' => 'GoldRelatedArticle'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.GoldSponsor",$manager);
return $f;
}
}
class GoldSponsorPage_Controller extends RightNav_Controller {
}
?>