N°3621 - Add config. parameter to disable "global search" history

This commit is contained in:
Molkobain
2021-01-13 10:53:11 +01:00
parent 9fccb6dd3f
commit 0a4db9bd50
4 changed files with 26 additions and 1 deletions

View File

@@ -48,6 +48,8 @@ class GlobalSearch extends UIBlock
protected $sEndpoint;
/** @var array $aLastQueries */
protected $aLastQueries;
/** @var bool $bShowHistory Whether or not to display the elements in the history */
protected $bShowHistory;
/** @var int $iMaxHistoryResults Max. number of elements in the history */
protected $iMaxHistoryResults;
@@ -64,6 +66,7 @@ class GlobalSearch extends UIBlock
parent::__construct($sId);
$this->SetEndpoint(static::DEFAULT_ENDPOINT_REL_URL);
$this->SetLastQueries($aLastQueries);
$this->bShowHistory = (bool) MetaModel::GetConfig()->Get('global_search.show_history');
$this->iMaxHistoryResults = (int) MetaModel::GetConfig()->Get('global_search.max_history_results');
}
@@ -119,6 +122,15 @@ class GlobalSearch extends UIBlock
return $this->aLastQueries;
}
/**
* @see $bShowHistory
* @return bool
*/
public function GetShowHistory(): bool
{
return $this->bShowHistory;
}
/**
* @see $iMaxHistoryResults
* @return int