Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

disappearing widgets


Go to End


1228 Views

Avatar
dacar

Community Member, 173 Posts

2 February 2012 at 4:39am

Edited: 02/02/2012 4:42am

Hi,

if i put some widgets to the blogtree, the blogholder or a blogentry, they all disappear after saving the changes.

i have put the following to page.php:

public static $has_one = array(
'Sidebar' => 'WidgetArea'
);
and

$fields->addFieldToTab("Root.Content.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
$fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar"));

If i put widgets to a page i can save without problems. The widgets are showen after saving the changes.

I have searched the forum and found the problem often, but no solution to solve it. Can anybody help?

I have installed SS 2.4.5 and the latest Blog module.

Greetings, Carsten.

Here are some infos from Firebug:

ERROR [Notice]: Trying to get property of non-object
IN POST /admin/EditForm
Line 100 in /home/www/22/42/cwwebde822/cms/code/WidgetAreaEditor.php

Source
======
91:
92: // Sometimes the id is "new-1" or similar, ensure this doesn't get into the query
93: if(!is_numeric($newWidgetID)) {
94: $newWidgetID = 0;
95: }
96:
97: // \"ParentID\" = '0' is for the new page
98: $widget = DataObject::get_one(
99: 'Widget',
* 100: "(\"ParentID\" = '{$record->$name()->ID}' OR \"ParentID\" = '0') AND \"Widget\".\"ID\" =
'$newWidgetID'"
101: );
102:
103:
104: // check if we are updating an existing widget
105: if($widget && isset($missingWidgets[$widget->ID])) {
106: unset($missingWidgets[$widget->ID]);