Skip to content

Commit

Permalink
Sort the custom layout sections by their position (see #1042)
Browse files Browse the repository at this point in the history
Description
-----------

Fixes #861

Commits
-------

e2178ef Sort the custom layout sections by their position (see #861)
  • Loading branch information
leofeyer committed Dec 3, 2019
1 parent 2c4a456 commit 93cf65c
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions core-bundle/src/Resources/contao/widgets/ModuleWizard.php
Expand Up @@ -105,6 +105,8 @@ public function generate()
$cols[] = 'footer';
}

$positions = array();

// Add custom layout sections
if ($objRow->sections != '')
{
Expand All @@ -116,7 +118,8 @@ public function generate()
{
if (!empty($v['id']))
{
$cols[$v['id']] = $v['id'];
$cols[] = $v['id'];
$positions[$v['id']] = $v['position'];
}
}
}
Expand All @@ -137,17 +140,31 @@ public function generate()
}
else
{
$arrCols = array();

// Initialize the sorting order
foreach (array_keys($cols) as $col)
{
$arrCols[$col] = array();
}
$arrCols = array
(
'top' => array(),
'header' => array(),
'before' => array(),
'left' => array(),
'right' => array(),
'main' => array(),
'after' => array(),
'footer' => array(),
'bottom' => array(),
'manual' => array()
);

foreach ($this->varValue as $v)
{
$arrCols[$v['col']][] = $v;
$key = $v['col'];

if (isset($positions[$v['col']]))
{
$key = $positions[$v['col']];
}

$arrCols[$key][] = $v;
}

$this->varValue = array();
Expand Down

0 comments on commit 93cf65c

Please sign in to comment.