N°2847 - Global Search: Fix class images URL, rename internal variable

This commit is contained in:
Molkobain
2020-08-03 12:04:19 +02:00
parent c7e95676d2
commit a15235d522
2 changed files with 11 additions and 4 deletions

View File

@@ -52,15 +52,15 @@ class GlobalSearch extends UIBlock
* GlobalSearch constructor.
*
* @param string $sId
* @param array $aLastClasses
* @param array $aLastQueries
*
* @throws \Exception
*/
public function __construct($sId = null, $aLastClasses = [])
public function __construct($sId = null, $aLastQueries = [])
{
parent::__construct($sId);
$this->SetEndpoint(static::DEFAULT_ENDPOINT_REL_URL);
$this->SetLastQueries($aLastClasses);
$this->SetLastQueries($aLastQueries);
}
/**

View File

@@ -101,19 +101,26 @@ class GlobalSearchHelper
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
* @throws \Exception
*/
public static function GetLastQueries()
{
/** @var array $aHistoryEntries */
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
// Add HTML label if missing
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
// Add HTML label if missing
if(!isset($aHistoryEntries[$iIdx]['label_html']))
{
$aHistoryEntries[$iIdx]['label_html'] = utils::HtmlEntities($aHistoryEntries[$iIdx]['query']);
}
// Set absolute URL
if(isset($aHistoryEntries[$iIdx]['icon_url']))
{
$aHistoryEntries[$iIdx]['icon_url'] = utils::GetAbsoluteUrlAppRoot().$aHistoryEntries[$iIdx]['icon_url'];
}
}
return $aHistoryEntries;