diff --git a/CHANGELOG.md b/CHANGELOG.md index c5eea15e9..a8b72500a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * Forward a `sid` to GPM when downloading a premium package via CLI * Allow `JsonFormatter` options to be passed as a string * Hide Flex Pages frontend configuration (not ready for production use) + * Improve Flex configuration: gather views together in blueprint 1. [](#bugfix) * *Menu Visibility Requires Access* Security option setting wrong frontmatter [login#265](https://github.com/getgrav/grav-plugin-login/issues/265) * Accessing page with unsupported file extension (jpg, pdf, xsl) will use wrong mime type [#3031](https://github.com/getgrav/grav/issues/3031) diff --git a/system/src/Grav/Framework/Flex/FlexDirectory.php b/system/src/Grav/Framework/Flex/FlexDirectory.php index 9a31b66a2..7d1797fcb 100644 --- a/system/src/Grav/Framework/Flex/FlexDirectory.php +++ b/system/src/Grav/Framework/Flex/FlexDirectory.php @@ -152,7 +152,7 @@ class FlexDirectory implements FlexDirectoryInterface, FlexAuthorizeInterface { if (null === $this->config) { $config = $this->getBlueprintInternal()->get('config', []); - $config = is_array($config) ? array_replace_recursive($config, $this->defaults, $this->getDirectoryConfig($config['admin']['configure']['form'] ?? null)) : null; + $config = is_array($config) ? array_replace_recursive($config, $this->defaults, $this->getDirectoryConfig($config['admin']['views']['configure']['form'] ?? $config['admin']['configure']['form'] ?? null)) : null; if (!is_array($config)) { throw new RuntimeException('Bad configuration'); } @@ -171,7 +171,7 @@ class FlexDirectory implements FlexDirectoryInterface, FlexAuthorizeInterface */ public function getDirectoryForm(string $name = null, array $options = []) { - $name = $name ?: $this->getConfig('admin.configure.form', ''); + $name = $name ?: $this->getConfig('admin.views.configure.form', '') ?: $this->getConfig('admin.configure.form', ''); return new FlexDirectoryForm($name ?? '', $this, $options); } @@ -252,7 +252,7 @@ class FlexDirectory implements FlexDirectoryInterface, FlexAuthorizeInterface $name = $name ?: $this->getFlexType(); $blueprint = $this->getBlueprint(); - return $blueprint->get('blueprints/configure/file') ?? "config://flex/{$name}.yaml"; + return $blueprint->get('blueprints/views/configure/file') ?? $blueprint->get('blueprints/configure/file') ?? "config://flex/{$name}.yaml"; } /** diff --git a/system/src/Grav/Framework/Flex/FlexObject.php b/system/src/Grav/Framework/Flex/FlexObject.php index c8819e41e..2a271f021 100644 --- a/system/src/Grav/Framework/Flex/FlexObject.php +++ b/system/src/Grav/Framework/Flex/FlexObject.php @@ -226,7 +226,8 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface { $properties = (array)($properties ?? $this->getFlexDirectory()->getConfig('data.search.fields')); if (!$properties) { - foreach ($this->getFlexDirectory()->getConfig('admin.list.fields', []) as $property => $value) { + $fields = $this->getFlexDirectory()->getConfig('admin.views.list.fields') ?? $this->getFlexDirectory()->getConfig('admin.list.fields', []); + foreach ($fields as $property => $value) { if (!empty($value['link'])) { $properties[] = $property; }