I am having a bad day with silverstripe today. I have just downloaded a whole new version of silevrstripe, gridfieldbulkingeditingtools, sortablegridfield, widgets.
I have created my page type...
<?php
class Page extends SiteTree {
private static $db = array(
);
private static $has_one = array(
"TopImage" => "Image"
);
private static $has_many = array(
'ContentBlockVerticals' => 'ContentBlockVertical',
'ContentBlockHorzs' => 'ContentBlockHorz',
'Faqs' => 'Faq',
'LowerCallToActions' => 'LowerCallToAction'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$gridFieldConfig = GridFieldConfig_RecordEditor::create();
$ContentBlockVerticals = new GridField("ContentBlockVerticals", "Content Block Vertical", $this->ContentBlockVerticals(), $gridFieldConfig);
$gridFieldConfig = GridFieldConfig_RecordEditor::create();
$ContentBlockHorzs = new GridField("ContentBlockHorzs", "Contact Block Horz", $this->ContentBlockHorzs(), $gridFieldConfig);
$gridFieldConfig = GridFieldConfig_RecordEditor::create();
$Faqs = new GridField("Faqs", "Faqs", $this->Faqs(), $gridFieldConfig);
$gridFieldConfig = GridFieldConfig_RecordEditor::create();
$LowerCallToAction = new GridField("LowerCallToActions", "LowerCallToAction", $this->LowerCallToActions(), $gridFieldConfig);
$contentblocks = new TabSet(
$name = "ContentBlockTabs",
new Tab(
$title='Vertical Blocks',
new HeaderField("Content Block Vertical"),
$ContentBlockVerticals
),
new Tab(
$title='Horizontal Blocks',
new HeaderField("Contact Block Horz"),
$ContentBlockHorzs
),
new Tab(
$title='Faqs',
new HeaderField("Faqs"),
$Faqs
),
new Tab(
$title='Lower CTAs',
new HeaderField("Lower CTAs"),
$LowerCallToAction
)
);
$fields->addFieldToTab('Root.ContentBlocks', $contentblocks );
return $fields;
}
}
class Page_Controller extends ContentController implements PermissionProvider {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
private static $allowed_actions = array (
"logout"
);
public function init() {
parent::init();
}
function providePermissions(){
return array('REGISTERED_USER' => 'Registered user of expense system');
}
function logout() {
Security::logout(false);
Controller::redirect("members/");
}
}
and for some reason when I add any page type, or dataobject it just "hangs", but does actually add it. It seems AddForm is getting no data when putting break points in the ajax function...
var newContentEls = self.handleAjaxResponse(data, status, xhr);
data = null
I really dont understand why its doing this at all - lost 4 hours to it so far!!
Thanks