It is now possible to use regex as values for "Hide page types in Admin" and "Hide modular page types in Admin" settings (fixes #1828)

This commit is contained in:
Djamil Legato
2020-11-21 15:15:55 -08:00
parent bd87db1931
commit 77fd8900f3
2 changed files with 23 additions and 4 deletions

View File

@@ -13,6 +13,7 @@
* Added modal to confirm updating Grav as well as cool down counter before enabling Update button [#1257](https://github.com/getgrav/grav-plugin-admin/issues/1257)
* Better handling of offline/intranet mode when the repository index is missing. Faster admin. [#1916](https://github.com/getgrav/grav-plugin-admin/issues/1916)
* Statistics is now Page View Statistics [#1885](https://github.com/getgrav/grav-plugin-admin/issues/1885)
* It is now possible to use regex as values for "Hide page types in Admin" and "Hide modular page types in Admin" settings [#1828](https://github.com/getgrav/grav-plugin-admin/issues/1828)
1. [](#bugfix)
* Fixed Safari issue with new ACL picker field [#1955](https://github.com/getgrav/grav-plugin-admin/issues/1955)
* Stop propagation of ACL add button in ACL picker [flex-objects#83](https://github.com/trilbymedia/grav-plugin-flex-objects/issues/83)

View File

@@ -921,8 +921,17 @@ class AdminPlugin extends Plugin
// First filter by configuration
$hideTypes = Grav::instance()['config']->get('plugins.admin.hide_page_types', []);
foreach ((array) $hideTypes as $type) {
unset($types[$type]);
foreach ((array) $hideTypes as $hide) {
if (isset($types[$hide])) {
unset($types[$hide]);
} else {
foreach ($types as $key => $type) {
$match = preg_match('#' . $hide . '#i', $key);
if ($match) {
unset($types[$key]);
}
}
}
}
// Allow manipulating of the data by event
@@ -946,8 +955,17 @@ class AdminPlugin extends Plugin
// First filter by configuration
$hideTypes = (array) Grav::instance()['config']->get('plugins.admin.hide_modular_page_types', []);
foreach ($hideTypes as $type) {
unset($types[$type]);
foreach ((array) $hideTypes as $hide) {
if (isset($types[$hide])) {
unset($types[$hide]);
} else {
foreach ($types as $key => $type) {
$match = preg_match('#' . $hide . '#i', $key);
if ($match) {
unset($types[$key]);
}
}
}
}
// Allow manipulating of the data by event