N°5874 - Quick create: improvement for newcomer

This commit is contained in:
XavierGR
2024-11-21 15:11:55 +01:00
parent 0d8a20c35e
commit dc2064450b
22 changed files with 175 additions and 10 deletions

View File

@@ -59,10 +59,14 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
protected $aLastClasses;
/** @var int $iMaxAutocompleteResults Max. number of elements returned by the autocomplete */
protected $iMaxAutocompleteResults;
/** @var bool $bShowHistory Whether or not to display the elements in the history */
/** @var bool $bShowHistory Whether to display the elements in the history */
protected $bShowHistory;
/** @var int $iMaxHistoryResults Max. number of elements in the history */
protected $iMaxHistoryResults;
/** @var int $iMaxPopularResults Max. number of elements in popular */
protected $iMaxPopularResults;
/** @var array $aPopularClasses */
protected $aPopularClasses;
/**
* QuickCreate constructor.
@@ -82,6 +86,8 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
$this->iMaxAutocompleteResults = (int) MetaModel::GetConfig()->Get('quick_create.max_autocomplete_results');
$this->bShowHistory = (bool) MetaModel::GetConfig()->Get('quick_create.show_history');
$this->iMaxHistoryResults = (int) MetaModel::GetConfig()->Get('quick_create.max_history_results');
$this->iMaxPopularResults = (int) MetaModel::GetConfig()->Get('quick_create.max_popular_results');
$this->aPopularClasses = QuickCreateHelper::GetPopularClasses();
}
/**
@@ -89,7 +95,7 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
* If $bRelativeUrl is true, then $sEndpoint will be complete with the app_root_url
*
* @param string $sEndpoint URL to the endpoint
* @param bool $bRelativeUrl Whether or not the $sEndpoint parameter is a relative URL
* @param bool $bRelativeUrl Whether the $sEndpoint parameter is a relative URL
*
* @return $this
* @throws \Exception
@@ -203,6 +209,24 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
return $this->iMaxHistoryResults;
}
/**
* @see $aMaxPopularClasses
* @return array
*/
public function GetPopularClasses(): array
{
return $this->aPopularClasses;
}
/**
* @see $iMaxPopularResults
* @return int
*/
public function GetMaxPopularResults(): int
{
return $this->iMaxPopularResults;
}
public static function GetShortcutKeys(): array
{
return [['id' => 'ibo-open-quick-create', 'label' => 'UI:Component:QuickCreate:KeyboardShortcut:OpenDrawer', 'key' => 'c', 'event' => 'open_drawer']];