From 1612a5e5cadfd7cb67602eeca16a941902c0a155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= Date: Wed, 21 Nov 2018 21:29:27 -0300 Subject: [PATCH] Allow override of `config-*@` / `data-*@` ```yaml # parent fields: foo: data-options@: ['\Grav\Plugin\MyPlugin::foo', false] ``` ```yaml # child fields: import@: type: blueprints.yaml:form/fields context: plugins://myplugin foo: unset-data-options@@: true data-options@: ['\Grav\Plugin\MyPlugin::foo', true] ``` --- Blueprints/src/BlueprintForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Blueprints/src/BlueprintForm.php b/Blueprints/src/BlueprintForm.php index 832fdfc..ce68545 100644 --- a/Blueprints/src/BlueprintForm.php +++ b/Blueprints/src/BlueprintForm.php @@ -332,7 +332,7 @@ protected function deepMerge(array $a, array $b) foreach ($head as $key => $value) { if (strpos($key, '@') !== false) { // Remove @ from the start and the end. Key syntax `import@2` is supported to allow multiple operations of the same type. - $list = explode('-', preg_replace('/^(@*)?([^@]+)(@\d*)?$/', '\2', $key), 2); + $list = explode('-', preg_replace('/^(?:@*)?(.*?)(?:@\d*)?$/', '\1', $key), 2); $action = array_shift($list); $property = array_shift($list); @@ -380,7 +380,7 @@ protected function deepInit(array &$items, $path = []) // Handle special instructions in the form. if (strpos($key, '@') !== false) { // Remove @ from the start and the end. Key syntax `import@2` is supported to allow multiple operations of the same type. - $list = explode('-', preg_replace('/^(@*)?([^@]+)(@\d*)?$/', '\2', $key), 2); + $list = explode('-', preg_replace('/^(?:@*)?(.*?)(?:@\d*)?$/', '\1', $key), 2); $action = array_shift($list); $property = array_shift($list);