mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-02 14:18:26 +02:00
MINOR Merged from trunk
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@77992 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
233f5e79e9
commit
d663843020
@ -64,8 +64,20 @@ class WidgetAreaEditor extends FormField {
|
|||||||
foreach(array_keys( $_REQUEST['Widget'] ) as $newWidgetID ) {
|
foreach(array_keys( $_REQUEST['Widget'] ) as $newWidgetID ) {
|
||||||
$newWidgetData = $_REQUEST['Widget'][$newWidgetID];
|
$newWidgetData = $_REQUEST['Widget'][$newWidgetID];
|
||||||
|
|
||||||
// `ParentID`=0 is for the new page
|
// Sometimes the id is "new-1" or similar, ensure this doesn't get into the query
|
||||||
$widget = DataObject::get_one( 'Widget', "(`ParentID`='{$record->$name()->ID}' OR `ParentID`=0) AND `Widget`.`ID`='$newWidgetID'" );
|
if(!is_numeric($newWidgetID)) {
|
||||||
|
$newWidgetID = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// \"ParentID\" = '0' is for the new page
|
||||||
|
$widget = DataObject::get_one(
|
||||||
|
'Widget',
|
||||||
|
sprintf(
|
||||||
|
'(`ParentID` = %d OR `ParentID` = 0) AND `Widget`.`ID` = %d',
|
||||||
|
$record->$name()->ID,
|
||||||
|
(int)$newWidgetID
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// check if we are updating an existing widget
|
// check if we are updating an existing widget
|
||||||
if($widget && isset($missingWidgets[$widget->ID]))
|
if($widget && isset($missingWidgets[$widget->ID]))
|
||||||
|
Loading…
Reference in New Issue
Block a user