Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Reset modules array keys [close #12]
Browse files Browse the repository at this point in the history
  • Loading branch information
Septdir committed May 17, 2019
1 parent 4cc0e6b commit 2eb2308
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jyproextra.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,22 +445,31 @@ public function onAfterCleanModuleList(&$modules)
$app = Factory::getApplication();
if ($app->isClient('site') && $app->getTemplate() === 'yootheme' && !empty($modules))
{
$resetKeys = false;
foreach ($modules as $key => $module)
{
$params = new Registry($module->params);

// Unset in customizer
if ($params->get('unset_customizer') && $app->input->get('customizer'))
{
$resetKeys = true;
unset($modules[$key]);
}

// Hide empty content modules
elseif ($params->get('unset_empty') && !$content = ModuleHelper::renderModule($module))
{
$resetKeys = true;
unset($modules[$key]);
}
}

// Reset modules array keys
if ($resetKeys)
{
$modules = array_values($modules);
}
}
}
}

0 comments on commit 2eb2308

Please sign in to comment.