21307 Posts in 5737 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 508 Views |
-
SiteTree dropdown not working in fieldset popup

5 October 2011 at 10:36pm
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.phpSource
======
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.phpViewableData->XML_val(InternalLink)
line 1367 of TableListField.phpTableListField_Item->Fields()
line 651 of DataObjectManager.phpDataObjectManager_Item->Fields()
line 369 of ViewableData.phpViewableData->obj(Fields)
line 434 of .cache.dataobject_manager.templates.ImageDataObjectManager.ssinclude(/var/sites/1/19thholegolfgetaways.co.uk/public_html/silverstripe-cache/.cache.dataobject_manager.templates.ImageDataObjectManager.ss)
line 420 of SSViewer.phpSSViewer->process(ImageDataObjectManager)
line 342 of ViewableData.phpViewableData->renderWith(ImageDataObjectManager)
line 275 of ComplexTableField.phpComplexTableField->FieldHolder()
line 282 of DataObjectManager.phpDataObjectManager->FieldHolder()
line 281 of TableListField.phpTableListField->index(SS_HTTPRequest)
line 143 of RequestHandler.phpRequestHandler->handleRequest(SS_HTTPRequest)
line 161 of RequestHandler.phpRequestHandler->handleRequest(SS_HTTPRequest)
line 161 of RequestHandler.phpRequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.phpController->handleRequest(SS_HTTPRequest)
line 282 of Director.phpDirector::handleRequest(SS_HTTPRequest,Session)
line 125 of Director.phpDirector::direct(/admin/EditForm/field/Calltoactions)
line 127 of main.phpAny help would be great!
-
Re: SiteTree dropdown not working in fieldset popup

6 October 2011 at 5:31am
I don't think it ever really worked in a popup - at least not in 2.4...
I recall Uncle Cheese having a simple version of the dropdown in the dataobject-manager module. Look at /dataobject-manager/code/dropdown-fields/SimpleTreeDropdownField.php
-
Re: SiteTree dropdown not working in fieldset popup

6 October 2011 at 11:55pm
Cool that worked... although I hope in SS3 this will be fixed and sorted as standard!
| 508 Views | ||
|
Page:
1
|
Go to Top |

