mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
MINOR Tabs must be used to indent lines and line lenght preferable less than 100chars.
This commit is contained in:
parent
cc3aa49f9f
commit
57a95c1484
@ -94,28 +94,28 @@ class WidgetAreaEditor extends FormField {
|
||||
}
|
||||
|
||||
// \"ParentID\" = '0' is for the new page
|
||||
$widget = DataObject::get_one(
|
||||
$widget = DataObject::get_one(
|
||||
'Widget',
|
||||
"(\"ParentID\" = '{$record->$name()->ID}' OR \"ParentID\" = '0') AND \"Widget\".\"ID\" = '$newWidgetID'"
|
||||
"(\"ParentID\" = '{$record->$name()->ID}' OR ".
|
||||
"\"ParentID\" = '0') AND \"Widget\".\"ID\" = '$newWidgetID'"
|
||||
);
|
||||
|
||||
|
||||
// check if we are updating an existing widget
|
||||
// check if we are updating an existing widget
|
||||
if($widget && isset($missingWidgets[$widget->ID])) {
|
||||
unset($missingWidgets[$widget->ID]);
|
||||
unset($missingWidgets[$widget->ID]);
|
||||
}
|
||||
|
||||
// create a new object
|
||||
if(!$widget && !empty($newWidgetData['Type']) && class_exists($newWidgetData['Type'])) {
|
||||
$widget = new $newWidgetData['Type']();
|
||||
$widget->ID = 0;
|
||||
$widget->ParentID = $record->$name()->ID;
|
||||
// create a new object
|
||||
if(!$widget && !empty($newWidgetData['Type']) && class_exists($newWidgetData['Type'])) {
|
||||
$widget = new $newWidgetData['Type']();
|
||||
$widget->ID = 0;
|
||||
$widget->ParentID = $record->$name()->ID;
|
||||
|
||||
if(!is_subclass_of($widget, 'Widget')) {
|
||||
$widget = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_subclass_of($widget, 'Widget')) {
|
||||
$widget = null;
|
||||
}
|
||||
}
|
||||
|
||||
if($widget) {
|
||||
if($widget->ParentID == 0) {
|
||||
$widget->ParentID = $record->$name()->ID;
|
||||
|
@ -222,8 +222,8 @@ class Widget_Controller extends Controller {
|
||||
$className = $this->urlParams['ID'];
|
||||
if (class_exists('Translatable') && Member::currentUserID()) {
|
||||
// set current locale based on logged in user's locale
|
||||
$locale = Member::currentUser()->Locale;
|
||||
Translatable::set_current_locale($locale);
|
||||
$locale = Member::currentUser()->Locale;
|
||||
Translatable::set_current_locale($locale);
|
||||
i18n::set_locale($locale);
|
||||
}
|
||||
if(class_exists($className) && is_subclass_of($className, 'Widget')) {
|
||||
|
Loading…
Reference in New Issue
Block a user