Improve code standards in Model\Item
This commit is contained in:
parent
2fa9d49632
commit
d9361f2b81
1 changed files with 9 additions and 10 deletions
|
@ -3146,16 +3146,16 @@ class Item
|
||||||
*/
|
*/
|
||||||
public static function makeImageGrid(array $images): string
|
public static function makeImageGrid(array $images): string
|
||||||
{
|
{
|
||||||
$landscapeimages = array();
|
$landscapeimages = [];
|
||||||
$portraitimages = array();
|
$portraitimages = [];
|
||||||
|
|
||||||
foreach ($images as $image) {
|
foreach ($images as $image) {
|
||||||
($image['attachment']['width'] > $image['attachment']['height']) ? ($landscapeimages[] = $image) : ($portraitimages[] = $image);
|
($image['attachment']['width'] > $image['attachment']['height']) ? ($landscapeimages[] = $image) : ($portraitimages[] = $image);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image for first column (fc) and second column (sc)
|
// Image for first column (fc) and second column (sc)
|
||||||
$images_fc = array();
|
$images_fc = [];
|
||||||
$images_sc = array();
|
$images_sc = [];
|
||||||
$lcount = count($landscapeimages);
|
$lcount = count($landscapeimages);
|
||||||
$pcount = count($portraitimages);
|
$pcount = count($portraitimages);
|
||||||
if ($lcount == 0 || $pcount == 0) {
|
if ($lcount == 0 || $pcount == 0) {
|
||||||
|
@ -3424,9 +3424,8 @@ class Item
|
||||||
$media = '';
|
$media = '';
|
||||||
if (count($images) > 1) {
|
if (count($images) > 1) {
|
||||||
$media = self::makeImageGrid($images);
|
$media = self::makeImageGrid($images);
|
||||||
}
|
} elseif (count($images) == 1) {
|
||||||
elseif (count($images) == 1) {
|
$media = Renderer::replaceMacros(Renderer::getMarkupTemplate('content/image.tpl'), [
|
||||||
$media = $media = Renderer::replaceMacros(Renderer::getMarkupTemplate('content/image.tpl'), [
|
|
||||||
'$image' => $images[0],
|
'$image' => $images[0],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue