From 76bb7fe4af60c129dafd57b5b830f2b13b4f726f Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 17 Jan 2020 15:07:57 +0200 Subject: [PATCH] Added support for loading flex type configuration --- system/blueprints/flex/shared/configure.yaml | 64 +++++++++++++++++++ system/blueprints/user/group.yaml | 2 +- .../src/Grav/Framework/Flex/FlexDirectory.php | 14 ++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 system/blueprints/flex/shared/configure.yaml diff --git a/system/blueprints/flex/shared/configure.yaml b/system/blueprints/flex/shared/configure.yaml new file mode 100644 index 000000000..9740a2234 --- /dev/null +++ b/system/blueprints/flex/shared/configure.yaml @@ -0,0 +1,64 @@ +form: + validation: loose + + fields: + plugin_tabs: + type: tabs + fields: + cache_tab: + type: tab + title: Caching + fields: + object.cache.index.enabled: + type: toggle + label: Enable Index Caching + highlight: 1 + default: 1 + options: + 1: Enabled + 0: Disabled + validate: + type: bool + + object.cache.index.timeout: + type: text + label: Index Cache Timeout (s) + default: 60 + validate: + type: int + + object.cache.object.enabled: + type: toggle + label: Enable Object Caching + highlight: 1 + default: 1 + options: + 1: Enabled + 0: Disabled + validate: + type: bool + + object.cache.object.timeout: + type: text + label: Object Cache Timeout (s) + default: 60 + validate: + type: int + + object.cache.render.enabled: + type: toggle + label: Enable Render Caching + highlight: 1 + default: 1 + options: + 1: Enabled + 0: Disabled + validate: + type: bool + + object.cache.render.timeout: + type: text + label: Render Cache Timeout (s) + default: 60 + validate: + type: int diff --git a/system/blueprints/user/group.yaml b/system/blueprints/user/group.yaml index 3ab07546f..64397a4ce 100644 --- a/system/blueprints/user/group.yaml +++ b/system/blueprints/user/group.yaml @@ -40,7 +40,7 @@ form: access: type: permissions - check_authorize: true + check_authorize: false label: PLUGIN_ADMIN.PERMISSIONS ignore_empty: true validate: diff --git a/system/src/Grav/Framework/Flex/FlexDirectory.php b/system/src/Grav/Framework/Flex/FlexDirectory.php index 0dc8f6228..d62ad62f8 100644 --- a/system/src/Grav/Framework/Flex/FlexDirectory.php +++ b/system/src/Grav/Framework/Flex/FlexDirectory.php @@ -158,6 +158,20 @@ class FlexDirectory implements FlexAuthorizeInterface return null === $name ? $this->config : $this->config->get($name, $default); } + /** + * @param string|null $name + * @return Blueprint|null + */ + public function getConfigureBlueprint(string $name = null) + { + $name = $name ?? 'configure'; + $path = "blueprints://flex/shared/{$name}.yaml"; + $blueprint = new Blueprint($path); + $blueprint->load()->init(); + + return $blueprint->form() ? $blueprint : null; + } + /** * Returns a new uninitialized instance of blueprint. *