Skip to content

Commit 61fd187

Browse files
author
Raphaël Droz
committed
further simplify deepImport()
1 parent 1282276 commit 61fd187

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

Blueprints/src/BlueprintForm.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,17 +404,11 @@ protected function deepImport(array &$items, $path = [])
404404
$item['name'] = $key;
405405
}
406406
// Handle special instructions in the form.
407-
if (strpos($key, '@') !== false) {
408-
// Remove @ from the start and the end. Key syntax `import@2` is supported to allow multiple operations of the same type.
409-
$list = explode('-', (string)preg_replace('/^(@*)?([^@]+)(@\d*)?$/', '\2', $key), 2);
410-
$action = array_shift($list);
411-
412-
if ($action == 'import') {
413-
unset($items[$key]);
414-
$this->doImport($item, $path);
415-
$run_again = true;
416-
break;
417-
}
407+
if (strpos($key, '@') !== false && preg_match('/^(@*)?import(@\d*)?$/', $key)) {
408+
unset($items[$key]);
409+
$this->doImport($item, $path);
410+
$run_again = true;
411+
break;
418412
} elseif (\is_array($item)) {
419413
// Recursively initialize form.
420414
$newPath = array_merge($path, [$key]);

0 commit comments

Comments
 (0)