Created
July 30, 2018 14:16
-
-
Save dzhuryn/5b25795beac7fbd9aa4df095307910d3 to your computer and use it in GitHub Desktop.
prepareWrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** @var $_DocLister DocLister */ | |
/** @var $data array */ | |
$placeholders = $data['placeholders']; | |
$categoryTpl = $_DocLister->getCFGDef('categoryTpl'); | |
$products = explode('<!--product-->',$placeholders['dl.wrap']); | |
$products = array_filter($products); | |
$groups = []; | |
$index=0; | |
foreach ($products as $product){ | |
$groups[$index] .= $product; | |
$index++; | |
if($index >= ceil(count($products)/2)){ $index=0;}; | |
} | |
$placeholders['dl.wrap'] = ''; | |
foreach ($groups as $group) { | |
$placeholders['dl.wrap'] .= DLTemplate::getInstance($modx)->parseChunk($categoryTpl,['dl.wrap'=>$group]); | |
} | |
return $placeholders; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment