diff --git a/modules/backend/assets/js/october.inspector.js b/modules/backend/assets/js/october.inspector.js index 88d4d13b9..a4baa7f33 100644 --- a/modules/backend/assets/js/october.inspector.js +++ b/modules/backend/assets/js/october.inspector.js @@ -587,7 +587,7 @@ // DROPDOWN EDITOR // ================== - + var InspectorEditorDropdown = function(editorId, inspector, fieldDef) { this.inspector = inspector this.fieldDef = fieldDef diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index e87683a2c..05754ef4e 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -107,6 +107,17 @@ class FormController extends ControllerBehavior */ if ($this->controller->isClassExtendedWith('Backend.Behaviors.RelationController')) $this->controller->initRelation($model); + + $this->prepareVars($model); + } + + /** + * Prepares common form data + */ + protected function prepareVars($model) + { + $this->controller->vars['formModel'] = $model; + $this->controller->vars['formRecordName'] = Lang::get($this->getConfig('name', 'backend::lang.model.name')); } // @@ -124,9 +135,8 @@ class FormController extends ControllerBehavior $this->context = strlen($context) ? $context : $this->getConfig('create[context]', 'create'); $this->controller->pageTitle = $this->controller->pageTitle ?: $this->getLang('create[title]', 'backend::lang.form.create_title'); $model = $this->controller->formCreateModelObject(); - $this->initForm($model); - $this->controller->vars['formModel'] = $model; + $this->initForm($model); } catch (Exception $ex) { $this->controller->handleError($ex); @@ -176,9 +186,8 @@ class FormController extends ControllerBehavior $this->context = strlen($context) ? $context : $this->getConfig('update[context]', 'update'); $this->controller->pageTitle = $this->controller->pageTitle ?: $this->getLang('update[title]', 'backend::lang.form.update_title'); $model = $this->controller->formFindModelObject($recordId); - $this->initForm($model); - $this->controller->vars['formModel'] = $model; + $this->initForm($model); } catch (Exception $ex) { $this->controller->handleError($ex); @@ -250,9 +259,8 @@ class FormController extends ControllerBehavior $this->context = strlen($context) ? $context : $this->getConfig('preview[context]', 'preview'); $this->controller->pageTitle = $this->controller->pageTitle ?: $this->getLang('preview[title]', 'backend::lang.form.preview_title'); $model = $this->controller->formFindModelObject($recordId); - $this->initForm($model); - $this->controller->vars['formModel'] = $model; + $this->initForm($model); } catch (Exception $ex) { $this->controller->handleError($ex); @@ -353,10 +361,10 @@ class FormController extends ControllerBehavior { $name = $this->getConfig($name, $default); $vars = [ - 'name' => Lang::get($this->getConfig('name', trans('backend::lang.model.name'))) + 'name' => Lang::get($this->getConfig('name', 'backend::lang.model.name')) ]; $vars = array_merge($vars, $extras); - return trans($name, $vars); + return Lang::get($name, $vars); } // diff --git a/modules/backend/lang/de/lang.php b/modules/backend/lang/de/lang.php index c9a1b0796..ee851ae68 100644 --- a/modules/backend/lang/de/lang.php +++ b/modules/backend/lang/de/lang.php @@ -163,8 +163,8 @@ return [ 'select_placeholder' => 'Bitte auswählen', 'insert_row' => 'Reihe einfügen', 'delete_row' => 'Reihe löschen', - 'concurrency-file-changed-title' => 'Datei wurde geändert', - 'concurrency-file-changed-description' => 'Die Datei, welche Sie bearbeiten, wurde auf von einem anderen Benutzer geändert. Sie können die Datei entweder erneut laden, wodurch Ihre Änderungen verloren gehen oder Sie überschreiben die Datei auf dem Server', + 'concurrency_file_changed_title' => 'Datei wurde geändert', + 'concurrency_file_changed_description' => 'Die Datei, welche Sie bearbeiten, wurde auf von einem anderen Benutzer geändert. Sie können die Datei entweder erneut laden, wodurch Ihre Änderungen verloren gehen oder Sie überschreiben die Datei auf dem Server', 'reload' => 'Erneut laden', ], 'relation' => [ diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index 4442ad9f0..2243df5f3 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -139,14 +139,18 @@ return [ 'missing_model' => 'Form behavior used in :class does not have a model defined.', 'missing_definition' => "Form behavior does not contain a field for ':field'.", 'not_found' => 'Form record with an ID of :id could not be found.', + 'action_confirm' => "Are you sure?", 'create' => 'Create', 'create_and_close' => 'Create and close', 'creating' => 'Creating...', + 'creating_name' => 'Creating :name...', 'save' => 'Save', 'save_and_close' => 'Save and close', 'saving' => 'Saving...', + 'saving_name' => 'Saving :name...', 'delete' => 'Delete', 'deleting' => 'Deleting...', + 'deleting_name' => 'Deleting :name...', 'undefined_tab' => 'Misc', 'field_off' => 'Off', 'field_on' => 'On', @@ -154,6 +158,8 @@ return [ 'apply' => 'Apply', 'cancel' => 'Cancel', 'close' => 'Close', + 'confirm' => 'Confirm', + 'reload' => 'Reload', 'ok' => 'OK', 'or' => 'or', 'confirm_tab_close' => 'Do you really want to close the tab? Unsaved changes will be lost.', @@ -165,16 +171,15 @@ return [ 'select_placeholder' => 'please select', 'insert_row' => 'Insert Row', 'delete_row' => 'Delete Row', - 'concurrency-file-changed-title' => 'File was changed', - 'concurrency-file-changed-description' => 'The file you\'re editing has been changed on disk by another user. You can either reload the file and lose your changes or override the file on the disk.', - 'reload' => 'Reload', + 'concurrency_file_changed_title' => "File was changed", + 'concurrency_file_changed_description' => "The file you're editing has been changed on disk by another user. You can either reload the file and lose your changes or override the file on the disk.", ], 'relation' => [ 'missing_definition' => "Relation behavior does not contain a definition for ':field'.", 'missing_model' => "Relation behavior used in :class does not have a model defined.", 'invalid_action_single' => "This action cannot be performed on a singular relationship.", 'invalid_action_multi' => "This action cannot be performed on a multiple relationship.", - 'help' => "Click on an item to add", + 'help' => "Click on an item to add", 'related_data' => "Related :name data", 'add' => "Add", 'add_selected' => "Add selected", diff --git a/modules/backend/lang/fa/lang.php b/modules/backend/lang/fa/lang.php index 96571f99d..9c40d06c1 100644 --- a/modules/backend/lang/fa/lang.php +++ b/modules/backend/lang/fa/lang.php @@ -165,8 +165,8 @@ return [ 'select_placeholder' => 'لطفا انتخاب نمایید', 'insert_row' => 'افزودن سطر', 'delete_row' => 'حذف سطر', - 'concurrency-file-changed-title' => 'فایل تغییر کرد', - 'concurrency-file-changed-description' => 'فایلی که شما ویرایش کردید توسط کاربر دیگری تغییر یافته و ذخیره شده است. شما میتوانید فایل را مجددا بارگذاری نمایید و تغییراتی که اعمال کرده اید را از دست بدهید و یا تغییرات اعمال شده توسط آن کاربر را بین برده و فایل را بازنویسی نمایید.', + 'concurrency_file_changed_title' => 'فایل تغییر کرد', + 'concurrency_file_changed_description' => 'فایلی که شما ویرایش کردید توسط کاربر دیگری تغییر یافته و ذخیره شده است. شما میتوانید فایل را مجددا بارگذاری نمایید و تغییراتی که اعمال کرده اید را از دست بدهید و یا تغییرات اعمال شده توسط آن کاربر را بین برده و فایل را بازنویسی نمایید.', 'reload' => 'بارگذاری مجدد', ], 'relation' => [ diff --git a/modules/backend/traits/InspectableContainer.php b/modules/backend/traits/InspectableContainer.php index 3b6eb64ca..90a2bea73 100644 --- a/modules/backend/traits/InspectableContainer.php +++ b/modules/backend/traits/InspectableContainer.php @@ -1,8 +1,8 @@ $value) { - if (!in_array($name, $translate)) continue; - $property[$name] = Lang::get($value); + if (!in_array($name, $translate)) + continue; + + if (is_array($value)) { + array_walk($property[$name], function(&$_value, $key) { $_value = Lang::get($_value); }); + } + else { + $property[$name] = Lang::get($value); + } } $result[] = $property; diff --git a/modules/cms/formwidgets/Components.php b/modules/cms/formwidgets/Components.php index a3f6014c0..5c94c9305 100644 --- a/modules/cms/formwidgets/Components.php +++ b/modules/cms/formwidgets/Components.php @@ -44,12 +44,16 @@ class Components extends FormWidgetBase $componentObj->alias = $alias; $componentObj->pluginIcon = 'icon-puzzle-piece'; + /* + * Look up the plugin hosting this component + */ $plugin = $manager->findComponentPlugin($componentObj); if ($plugin) { $pluginDetails = $plugin->pluginDetails(); if (isset($pluginDetails['icon'])) $componentObj->pluginIcon = $pluginDetails['icon']; } + } catch (Exception $ex) { $componentObj = new UnknownComponent(null, $properties, $ex->getMessage()); diff --git a/modules/cms/formwidgets/components/partials/_component.htm b/modules/cms/formwidgets/components/partials/_component.htm index 41f5834ec..0707d8ba9 100644 --- a/modules/cms/formwidgets/components/partials/_component.htm +++ b/modules/cms/formwidgets/components/partials/_component.htm @@ -1,6 +1,6 @@
-
inspectorEnabled): ?>data-inspectable data-inspector-title="getComponentName($component)) ?>" data-inspector-description="getComponentDescription($component)) ?>" @@ -9,9 +9,9 @@ alias) ?> - - - + + + ×
\ No newline at end of file diff --git a/modules/cms/formwidgets/components/partials/_formcomponents.htm b/modules/cms/formwidgets/components/partials/_formcomponents.htm index 51af8f844..842d04771 100644 --- a/modules/cms/formwidgets/components/partials/_formcomponents.htm +++ b/modules/cms/formwidgets/components/partials/_formcomponents.htm @@ -1,18 +1,17 @@
- isHidden) - echo $this->makePartial('component', ['component'=>$component]); - } - ?> + + isHidden): ?> + makePartial('component', ['component' => $component]) ?> + + +
- isHidden) - echo $this->makePartial('component', ['component'=>$component]); - } - ?> + + isHidden): ?> + makePartial('component', ['component' => $component]) ?> + +