From: Vincent Vanwaelscappel Date: Tue, 13 Aug 2019 14:37:20 +0000 (+0200) Subject: #2904 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=98ca0fd7ec5b8e719669992a1956ec127a4ce968;p=cubist_cms-back.git #2904 --- diff --git a/composer.json b/composer.json index ba5817e..2afa55e 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "cubist\/cms-back", + "name": "cubist/cms-back", "description": "Cubist Backpack extension", "type": "library", "license": "proprietary", diff --git a/src/app/Magic/PageData.php b/src/app/Magic/PageData.php index 57b8d0a..9b3579b 100644 --- a/src/app/Magic/PageData.php +++ b/src/app/Magic/PageData.php @@ -47,7 +47,26 @@ class PageData implements \ArrayAccess */ public function set($offset, $value) { - Arr::set($this->_data, $offset, $value); + $offset = square_brackets_to_dots($offset); + Arr::set($this->_data, $offset, $this->_fixValue($value)); + } + + protected function _fixValue($value) + { + if (!is_array($value)) { + return $value; + } + return $this->_fixArray($value); + } + + protected function _fixArray($value) + { + $dot = Arr::dot($value); + $res = []; + foreach ($dot as $k => $v) { + Arr::set($res, square_brackets_to_dots($k), $v); + } + return $res; } /** diff --git a/src/public/bunchmultiple/bunchmultiple.js b/src/public/bunchmultiple/bunchmultiple.js index 3362fbf..85d7fd5 100644 --- a/src/public/bunchmultiple/bunchmultiple.js +++ b/src/public/bunchmultiple/bunchmultiple.js @@ -112,7 +112,7 @@ removeItem: function (item) { $(item).remove(); - if (this.element.find('.item:not(.sample)').length == 0) { + if (this.element.find('.item:not(.sample)').length === 0) { this.initItem(); } this.update(); @@ -152,7 +152,7 @@ } }); }catch (e) { - + } this.updateLegends(); }, diff --git a/src/resources/views/fields/button.blade.php b/src/resources/views/fields/button.blade.php index 1e25404..2f069e7 100644 --- a/src/resources/views/fields/button.blade.php +++ b/src/resources/views/fields/button.blade.php @@ -6,7 +6,7 @@ $field['allows_null'] = false; $page_model = $field['page_model']; $active_pages = \Cubist\Backpack\app\Magic\Models\CMSPage::getPagesList(); -$empty = ['label' => '', 'type' => 'page_link', 'link' => '', 'external_link' => '', 'page_id' => '']; +$empty = ['label' => '', 'type' => 'none', 'link' => '', 'external_link' => '', 'page_id' => '']; $value = old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? []; if ($value == '') { $value = [];