Fixes issue where snippet data (viewBag) is not saved
^- when there are no components used on the partial + Minor lang fix
This commit is contained in:
parent
c36971b8fc
commit
f2460cb7b8
|
|
@ -413,38 +413,51 @@ class Index extends Controller
|
|||
|
||||
protected function upgradeSettings($settings)
|
||||
{
|
||||
if (!array_key_exists('component_properties', $_POST)) {
|
||||
return $settings;
|
||||
}
|
||||
/*
|
||||
* Handle component usage
|
||||
*/
|
||||
$componentProperties = post('component_properties');
|
||||
$componentNames = post('component_names');
|
||||
$componentAliases = post('component_aliases');
|
||||
|
||||
if (!array_key_exists('component_names', $_POST) || !array_key_exists('component_aliases', $_POST)) {
|
||||
throw new ApplicationException(trans('cms::lang.component.invalid_request'));
|
||||
}
|
||||
|
||||
$count = count($_POST['component_properties']);
|
||||
if (count($_POST['component_names']) != $count || count($_POST['component_aliases']) != $count) {
|
||||
throw new ApplicationException(trans('cms::lang.component.invalid_request'));
|
||||
}
|
||||
|
||||
for ($index = 0; $index < $count; $index ++) {
|
||||
$componentName = $_POST['component_names'][$index];
|
||||
$componentAlias = $_POST['component_aliases'][$index];
|
||||
|
||||
$section = $componentName;
|
||||
if ($componentAlias != $componentName) {
|
||||
$section .= ' '.$componentAlias;
|
||||
if ($componentProperties !== null) {
|
||||
if ($componentNames === null || $componentAliases === null) {
|
||||
throw new ApplicationException(trans('cms::lang.component.invalid_request'));
|
||||
}
|
||||
|
||||
$properties = json_decode($_POST['component_properties'][$index], true);
|
||||
unset($properties['oc.alias']);
|
||||
unset($properties['inspectorProperty']);
|
||||
unset($properties['inspectorClassName']);
|
||||
$settings[$section] = $properties;
|
||||
$count = count($componentProperties);
|
||||
if (count($componentNames) != $count || count($componentAliases) != $count) {
|
||||
throw new ApplicationException(trans('cms::lang.component.invalid_request'));
|
||||
}
|
||||
|
||||
for ($index = 0; $index < $count; $index ++) {
|
||||
$componentName = $componentNames[$index];
|
||||
$componentAlias = $componentAliases[$index];
|
||||
|
||||
$section = $componentName;
|
||||
if ($componentAlias != $componentName) {
|
||||
$section .= ' '.$componentAlias;
|
||||
}
|
||||
|
||||
$properties = json_decode($componentProperties[$index], true);
|
||||
unset($properties['oc.alias']);
|
||||
unset($properties['inspectorProperty']);
|
||||
unset($properties['inspectorClassName']);
|
||||
$settings[$section] = $properties;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('viewBag', $_POST))
|
||||
$settings['viewBag'] = $_POST['viewBag'];
|
||||
/*
|
||||
* Handle view bag
|
||||
*/
|
||||
$viewBag = post('viewBag');
|
||||
if ($viewBag !== null) {
|
||||
$settings['viewBag'] = $viewBag;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extensibility
|
||||
*/
|
||||
$dataHolder = (object)[
|
||||
'settings' => $settings
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?= Form::open(['onsubmit'=>'return false']) ?>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="popup">×</button>
|
||||
<h4 class="modal-title"><?= e(trans('cms::lang.form.concurrency_file_changed_title')) ?></h4>
|
||||
<h4 class="modal-title"><?= e(trans('backend::lang.form.concurrency_file_changed_title')) ?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?= e(trans('cms::lang.form.concurrency_file_changed_description')) ?></p>
|
||||
<p><?= e(trans('backend::lang.form.concurrency_file_changed_description')) ?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
|
|
|
|||
Loading…
Reference in New Issue