Skip to content

Commit

Permalink
[#28754] mod_finder should not append an unnecessary item id (Fix #255)
Browse files Browse the repository at this point in the history
  • Loading branch information
okonomiyaki3000 committed May 15, 2014
1 parent 9fb23ec commit 1060d55
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions modules/mod_finder/helper.php
Expand Up @@ -31,31 +31,17 @@ class ModFinderHelper
*/
public static function getGetFields($route = null, $paramItem = 0)
{
$fields = null;
$fields = array();
$uri = JUri::getInstance(JRoute::_($route));
$uri->delVar('q');
$elements = $uri->getQuery(true);

// Create hidden input elements for each part of the URI.
// Add the current menu id if it doesn't have one
foreach ($elements as $n => $v)
foreach ($uri->getQuery(true) as $n => $v)
{
if ($n == 'Itemid')
{
continue;
}

$fields .= '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
$fields[] = '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
}

/*
* Figure out the Itemid value
* First, check if the param is set. If not, fall back to the Itemid from the JInput object
*/
$Itemid = $paramItem > 0 ? $paramItem : JFactory::getApplication()->input->getInt('Itemid');
$fields .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';

return $fields;
return implode('', $fields);
}

/**
Expand Down

0 comments on commit 1060d55

Please sign in to comment.