diff --git a/README.md b/README.md index 7fa52390..229a85b8 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,14 @@ GUI Extension for Mecha Release Notes ------------- -### master +### 2.4.0 - Removed `$lot` hook parameter and store the form data to `$_['form']` property, for easy form data manipulation during CRUD process. - Fixed bug where creating a new page does not populate the `time` data automatically. - Changed `#blob:{code}` language string into a more readable language string as the default language string for every blob response code. - Updated [Tag Picker](https://github.com/taufik-nurrohman/tag-picker) to version 3.0.12. - Moved `type` and `x` state data to a separated file, stored in `.\lot\x\panel\state` folder. + - Added ability to set custom panel definition through `.\lot\layout\index\panel.php` file. ### 2.3.2 diff --git a/panel/engine/r/route.php b/panel/engine/r/route.php index f8fe2a6f..e3d2b912 100644 --- a/panel/engine/r/route.php +++ b/panel/engine/r/route.php @@ -86,12 +86,18 @@ function route() { // Update data $_ = $GLOBALS['_']; } + // Load panel definition from a file stored in `.\lot\x\*\index\panel.php` foreach ($GLOBALS['X'][1] as $v) { \is_file($v = \Path::F($v) . \DS . 'panel.php') && (function($v) { extract($GLOBALS, \EXTR_SKIP); require $v; })($v); } + // Load panel definition from a file stored in `.\lot\layout\index\panel.php` + \is_file($v = \LOT . \DS . 'layout' . \DS . 'index' . \DS . 'panel.php') && (function($v) { + extract($GLOBALS, \EXTR_SKIP); + require $v; + })($v); // Update data $_ = $GLOBALS['_']; // Define lot with no filter diff --git a/panel/engine/r/task/g.php b/panel/engine/r/task/g.php index 32f633f8..3bb37044 100644 --- a/panel/engine/r/task/g.php +++ b/panel/engine/r/task/g.php @@ -166,11 +166,11 @@ function page($_) { unset($_['form']['page']['name'], $_['form']['page']['x']); $page = []; $p = (array) ($state->x->page->page ?? []); - // Remove array item(s) with `null` value - $nully = function($v) use(&$nully) { + // Remove array item(s) with empty value + $drop = function($v) use(&$drop) { foreach ($v as $kk => $vv) { if (\is_array($vv) && !empty($vv)) { - if ($vv = $nully($vv)) { + if ($vv = $drop($vv)) { $v[$kk] = $vv; } else { unset($v[$kk]); @@ -194,7 +194,7 @@ function page($_) { continue; } if (\is_array($v)) { - if ($v = $nully(\array_replace_recursive($page[$k] ?? [], $v))) { + if ($v = $drop(\array_replace_recursive($page[$k] ?? [], $v))) { $page[$k] = $v; } } else { @@ -253,11 +253,11 @@ function state($_) { 'token' => false, 'trash' => false ]) . $url->hash; - // Remove array item(s) with `null` value - $nully = function($v) use(&$nully) { + // Remove array item(s) with empty value + $drop = function($v) use(&$drop) { foreach ($v as $kk => $vv) { if (\is_array($vv) && !empty($vv)) { - if ($vv = $nully($vv)) { + if ($vv = $drop($vv)) { $v[$kk] = $vv; } else { unset($v[$kk]); @@ -276,7 +276,7 @@ function state($_) { if (\is_file($f = \LOT . \DS . \trim(\strtr($_['form']['path'] ?? $_['path'], '/', \DS), \DS))) { $_['f'] = $f = \realpath($f); $v = \array_replace_recursive((array) require $f, $_['form']['state'] ?? []); - $v = $nully($v); + $v = $drop($v); $_['form']['file']['content'] = $_POST['file']['content'] = 'x->page->page ?? []); - // Remove array item(s) with `null` value - $nully = function($v) use(&$nully) { + // Remove array item(s) with empty value + $drop = function($v) use(&$drop) { foreach ($v as $kk => $vv) { if (\is_array($vv) && !empty($vv)) { - if ($vv = $nully($vv)) { + if ($vv = $drop($vv)) { $v[$kk] = $vv; } else { unset($v[$kk]); @@ -246,7 +246,7 @@ function page($_) { continue; } if (\is_array($v)) { - if ($v = $nully(\array_replace_recursive($page[$k] ?? [], $v))) { + if ($v = $drop(\array_replace_recursive($page[$k] ?? [], $v))) { $page[$k] = $v; } } else {