mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 03:16:11 +01:00
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:
26
admin.php
26
admin.php
@@ -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
|
||||
|
Reference in New Issue
Block a user