mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
BUGFIX: check before shifting classes array in AvailableWidgets
BUGFIX: solved bug adding a new widget to the top of the widget area, then moving it to the bottom when saving
This commit is contained in:
parent
0177699620
commit
05ade5866b
@ -40,7 +40,7 @@ class WidgetAreaEditor extends FormField {
|
|||||||
|
|
||||||
foreach($this->widgetClasses as $widgetClass) {
|
foreach($this->widgetClasses as $widgetClass) {
|
||||||
$classes = ClassInfo::subclassesFor($widgetClass);
|
$classes = ClassInfo::subclassesFor($widgetClass);
|
||||||
array_shift($classes);
|
if(count($classes) > 1) array_shift($classes);
|
||||||
foreach($classes as $class) {
|
foreach($classes as $class) {
|
||||||
$widgets->push(singleton($class));
|
$widgets->push(singleton($class));
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
$(this).data('maxid', newID);
|
$(this).data('maxid', newID);
|
||||||
|
|
||||||
var widgetContent = response.replace(/Widget\[0\]/gi, "Widget[new-" + (newID) + "]");
|
var widgetContent = response.replace(/Widget\[0\]/gi, "Widget[new-" + (newID) + "]");
|
||||||
$('#usedWidgets-'+$(this).attr('name')).prepend(widgetContent);
|
$('#usedWidgets-'+$(this).attr('name')).append(widgetContent);
|
||||||
|
|
||||||
this.rewriteWidgetAreaAttributes();
|
this.rewriteWidgetAreaAttributes();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user