Skip to content

Commit

Permalink
Merged in article and menu item params. See HCBTMPLTE-48
Browse files Browse the repository at this point in the history
  • Loading branch information
bentasker committed Mar 21, 2014
1 parent b078974 commit ea4611c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions packages/mod_articles_mostpopular/helper.php
Expand Up @@ -125,6 +125,18 @@ public static function getList(&$params)
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));


// Get Menu Parameters
$app = JFactory::getApplication();
$menuId = $app->getMenu()->getActive()->id;
$menu = &JSite::getMenu();
$itempars = $menu->getItem($menuId)->params;
$menuParams = new JParameter($itempars);
$menuParams = $menuParams->toArray();
$globalParams = JComponentHelper::getParams('com_content', true);



foreach ($items as &$item) {
$item->slug = $item->id.':'.$item->alias;
Expand All @@ -137,6 +149,34 @@ public static function getList(&$params)
$item->alternative_readmore = $articleParams->get('alternative_readmore');
$item->layout = $articleParams->get('layout');
$item->params = $articleParams;
$articleArray = array();

foreach ($menuParamsArray as $key => $value)
{
if ($value === 'use_article')
{
// If the article has a value, use it
if ($articleParams->get($key) != '')
{
// Get the value from the article
$articleArray[$key] = $articleParams->get($key);
}
else
{
// Otherwise, use the global value
$articleArray[$key] = $globalParams->get($key);
}
}
}

// Merge the selected article params
if (count($articleArray) > 0)
{
$articleParams = new JRegistry;
$articleParams->loadArray($articleArray);
$item->params->merge($articleParams);
}


// get display date
switch ($item->params->get('list_show_date'))
Expand Down

0 comments on commit ea4611c

Please sign in to comment.