diff --git a/app/code/local/Df/Core/lib/array/find.php b/app/code/local/Df/Core/lib/array/find.php index b41a01700c..cc87e5d56c 100644 --- a/app/code/local/Df/Core/lib/array/find.php +++ b/app/code/local/Df/Core/lib/array/find.php @@ -1,40 +1,51 @@ $v) {/** @var int|string $k */ /** @var mixed $v */ /** @var mixed[] $primaryArgument */ @@ -53,5 +64,17 @@ function df_find($a1, $a2, $pAppend = [], $pPrepend = [], $keyPosition = 0) { break; } } + # 2023-07-25 + # 1) "Adapt `df_find` to the nested search": https://github.com/mage2pro/core/issues/251 + # 2) I implement the nested seach in a separate loop to minimize recursions. + if (null === $r && $nested) { + foreach ($a as $v) {/** @var int|string $k */ /** @var mixed $v */ /** @var mixed[] $primaryArgument */ + if (is_iterable($v)) { + if ($r = df_find($v, $f, $pAppend, $pPrepend, $keyPosition, true)) { + break; + } + } + } + } return $r; } \ No newline at end of file