Guys,
got an odd one. The SiteTree drop down is not working in a pop up... it put the drop down there, but when you select it, you just get the "loading" msg and it never actually loads the site tree. Here is my set up
calltoaction.php
<?php
class Calltoaction extends DataObject
{
static $has_one = array (
'Attachment' => 'File',
'InternalLink' => 'SiteTree',
'StaticSidebar' => 'StaticSidebar'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TreeDropdownField("InternalLinkID", "Choose a page which this call to action links to:", "SiteTree"),
new FileIFrameField('Attachment')
);
}
}
StaticSidebar.php
<?php
class StaticSidebar extends Page
{
static $has_many = array (
'Calltoactions' => 'Calltoaction'
);
public function getCMSFields()
{
$fields = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'Calltoactions', // Source name
'Calltoaction', // Source class
'Attachment', // File name on DataObject
array(
'InternalLink' => 'InternalLink'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$fields->addFieldToTab("Root.Content.Sidebar Images",$manager);
return $fields;
}
static $allowed_children = array("none");
}
class StaticSidebar_Controller extends Page_Controller {
public static $allowed_actions = array (
);
public function init() {
parent::init();
}
}
This is the error being trapped on
http://19thholegolfgetaways.co.uk/admin/EditForm/field/Calltoactions?SecurityID=e9ea1a8fafe6d260fcc0fe550181506c69f50cf7&ctf[Calltoactions][start]=0&ctf[Calltoactions][per_page]=10&ctf[Calltoactions][showall]=0&ctf[Calltoactions][sort]=&ctf[Calltoactions][sort_dir]=&ctf[Calltoactions][search]=&ctf[Calltoactions][filter]=&ctf[Calltoactions][view]=grid&ctf[Calltoactions][imagesize]=100
ERROR [User Error]: Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'SiteTree'
IN GET /admin/EditForm/field/Calltoactions?SecurityID=e9ea1a8fafe6d260fcc0fe550181506c69f50cf7&ctf[Calltoactions][start]=0&ctf[Calltoactions][per_page]=10&ctf[Calltoactions][showall]=0&ctf[Calltoactions][sort]=&ctf[Calltoactions][sort_dir]=&ctf[Calltoactions][search]=&ctf[Calltoactions][filter]=&ctf[Calltoactions][view]=grid&ctf[Calltoactions][imagesize]=100
Line 724 in /var/sites/1/19thholegolfgetaways.co.uk/public_html/sapphire/core/Object.php
Source
======
715:
716: default :
717: throw new Exception (
718: "Object->__call(): extra method $method is invalid on $this->class:" . var_export($config,
true)
719: );
720: }
721: } else {
722: // Please do not change the exception code number below.
723:
* 724: throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'",
2175);
725: }
726: }
727:
728: //
-----------------------------------------------------------------------------------------------------------------
729:
730: /**
Trace
=====
<ul>Object->__call(forTemplate,Array)
SiteTree->forTemplate()
line 447 of ViewableData.php
ViewableData->XML_val(InternalLink)
line 1367 of TableListField.php
TableListField_Item->Fields()
line 651 of DataObjectManager.php
DataObjectManager_Item->Fields()
line 369 of ViewableData.php
ViewableData->obj(Fields)
line 434 of .cache.dataobject_manager.templates.ImageDataObjectManager.ss
include(/var/sites/1/19thholegolfgetaways.co.uk/public_html/silverstripe-cache/.cache.dataobject_manager.templates.ImageDataObjectManager.ss)
line 420 of SSViewer.php
SSViewer->process(ImageDataObjectManager)
line 342 of ViewableData.php
ViewableData->renderWith(ImageDataObjectManager)
line 275 of ComplexTableField.php
ComplexTableField->FieldHolder()
line 282 of DataObjectManager.php
DataObjectManager->FieldHolder()
line 281 of TableListField.php
TableListField->index(SS_HTTPRequest)
line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
line 161 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
line 161 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
line 125 of Director.php
Director::direct(/admin/EditForm/field/Calltoactions)
line 127 of main.php
Any help would be great!