Has anyone allready got PageContentWidget working on ss3.2?
The widget installs ok but when you add the widget to the page youll get an error. it does not give further info!
I found the problem should be somewhere in the dropdownfield but dont know in ss3 how to solve this! Been looking in docs for ages.. but found no good descriptions how to call a sitetree for selection.
Get error 568 in framework/model/MySQLdatabase.php
<?php
class PageContentWidget extends Widget {
static $db = array(
"WidgetTitle" => "Varchar(255)",
"PageID" => "Int"
);
static $defaults = array(
"WidgetTitle" => 'Page Content',
"PageID" => 0
);
static $title = "";
static $cmsTitle = "Pagina inhoud tonen in de zijbalk";
static $description = "Laat een pagina in de zijbalk zien van max 140px breed.";
function getCMSFields() {
$obj = 'SiteTree';
$filter = "Status = 'Published'";
//adding Sort != 0 will typically remove Blog Posts and Forum Topics (can be buggy)
//$filter = "Status = 'Published AND Sort != 0'";
$sort = 'Title ASC';
$join = '';
$limit = '';
$records = DataObject::get($obj, $filter, $sort, $join, $limit);
$dropDownArray = array();
if($records->exists()) foreach( $records as $record ) {
$dropDownArray[$record->ID] = $record->Title;
}
return new FieldSet(
new TextField("WidgetTitle", "Type de titel welke bovenaan in de kop moet komen"),
new TreeDropdownField(
$name = "PageID",
$title = "Kies de pagina welke je in de zijbalk wilt tonen:",
$source = $dropDownArray
)
);
}
function output() {
$obj = 'SiteTree';
$id = $this->PageID;
$record = DataObject::get_by_id($obj,$id);
return $record->Content;
}
}
How can i solve this problem so the widget works?