add links

This commit is contained in:
Simon Vieille 2020-08-11 10:40:31 +02:00
parent 5a86e16861
commit 307f69906b
Signed by: deblan
GPG key ID: 03383D15A1D31745

View file

@ -18,14 +18,15 @@
namespace OCA\SideMenu\Controller; namespace OCA\SideMenu\Controller;
use OC\App\AppStore\Fetcher\CategoryFetcher;
use OCA\SideMenu\Service\AppRepository; use OCA\SideMenu\Service\AppRepository;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\IConfig; use OCP\IConfig;
use OCP\IL10N; use OCP\IL10N;
use OCP\IRequest; use OCP\IRequest;
use OC\App\AppStore\Fetcher\CategoryFetcher;
use OCP\L10N\IFactory; use OCP\L10N\IFactory;
use OC\URLGenerator;
class NavController extends Controller class NavController extends Controller
{ {
@ -54,6 +55,11 @@ class NavController extends Controller
*/ */
protected $categoryFetcher; protected $categoryFetcher;
/**
* @var URLGenerator
*/
protected $router;
/** /**
* @param string $appName * @param string $appName
*/ */
@ -62,16 +68,18 @@ class NavController extends Controller
IRequest $request, IRequest $request,
IConfig $config, IConfig $config,
AppRepository $appRepository, AppRepository $appRepository,
CategoryFetcher $categoryFetcher, CategoryFetcher $categoryFetcher,
IFactory $l10nFactory, URLGenerator $router,
IFactory $l10nFactory,
IL10N $trans) IL10N $trans)
{ {
parent::__construct($appName, $request); parent::__construct($appName, $request);
$this->config = $config; $this->config = $config;
$this->appRepository = $appRepository; $this->appRepository = $appRepository;
$this->categoryFetcher = $categoryFetcher; $this->categoryFetcher = $categoryFetcher;
$this->l10nFactory = $l10nFactory; $this->l10nFactory = $l10nFactory;
$this->router = $router;
$this->trans = $trans; $this->trans = $trans;
} }
@ -108,7 +116,7 @@ class NavController extends Controller
$items[$category]['apps'][$app['id']] = [ $items[$category]['apps'][$app['id']] = [
'name' => $app['name'], 'name' => $app['name'],
'href' => '#', 'href' => $this->router->linkTo($app['id'], ''),
'icon' => $app['previewAsIcon'] ? $app['preview'] : null, 'icon' => $app['previewAsIcon'] ? $app['preview'] : null,
]; ];
} }