Skip to content

Commit

Permalink
Split summarizer output on (.*) aswell. Close WEEE-Open#162
Browse files Browse the repository at this point in the history
  • Loading branch information
Learath2 committed Nov 23, 2022
1 parent 2e51727 commit 96f95aa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/SSRv1/templates/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
}
}

// A little more logic in a template won't kill, right?
$summary = \WEEEOpen\Tarallo\SSRv1\Summary\Summary::peel($item);
$summary_escaped = array_map([$this, 'e'], explode(', ', $summary));
$summary_split = preg_split("/(\(.*\))/", $summary, -1, PREG_SPLIT_DELIM_CAPTURE);
$summary_split = array_map(fn($v): array => str_starts_with($v, '(') ? [$v] : explode(', ', $v), $summary_split);
$flat = call_user_func_array('array_merge', $summary_split);
$summary_escaped = array_map([$this, 'e'], $flat);
unset($summary);

$product = $item->getProduct();
Expand Down

0 comments on commit 96f95aa

Please sign in to comment.