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.

Blog Module

Discuss the Blog Module.

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

disappearing widgets


Reply

412 Views

Avatar
dacar

2 February 2012 at 4:39am (Last edited: 2 February 2012 4:42am), Community Member, 168 Posts

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]);