diff options
Diffstat (limited to 'lib/Controller/TemplatesController.php')
-rw-r--r-- | lib/Controller/TemplatesController.php | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/Controller/TemplatesController.php b/lib/Controller/TemplatesController.php index 9aea5c7..5364e20 100644 --- a/lib/Controller/TemplatesController.php +++ b/lib/Controller/TemplatesController.php @@ -30,7 +30,6 @@ use Exception; use OC\AppFramework\Http; use OCA\FullTextSearch\AppInfo\Application; use OCA\FullTextSearch\Exceptions\ProviderDoesNotExistException; -use OCA\FullTextSearch\IFullTextSearchProvider; use OCA\FullTextSearch\Service\ConfigService; use OCA\FullTextSearch\Service\MiscService; use OCA\FullTextSearch\Service\ProviderService; @@ -42,6 +41,7 @@ use OCP\IRequest; class TemplatesController extends Controller { + /** @var IConfig */ private $config; @@ -90,19 +90,22 @@ class TemplatesController extends Controller { $providerWrapper = $this->providerService->getProvider($providerId); $provider = $providerWrapper->getProvider(); - $panel = []; - $options = $provider->getOptionsTemplate(); - if (is_array($options) && array_key_exists('panel', $options)) { - $panel = $options['panel']; - } + $searchTemplate = $provider->getSearchTemplate(); - if (array_key_exists('template', $panel)) { + $template = ''; + if ($searchTemplate->getTemplate() !== '') { $tmpl = - new TemplateResponse($providerWrapper->getAppId(), $panel['template'], [], 'blank'); - $panel['template'] = $tmpl->render(); + new TemplateResponse( + $providerWrapper->getAppId(), $searchTemplate->getTemplate(), [], 'blank' + ); + $template = $tmpl->render(); } - $ret[$providerId] = $panel; + $ret[$providerId] = + [ + 'options' => $searchTemplate->getPanelOptions(), + 'template' => $template + ]; return new DataResponse($ret, Http::STATUS_OK); } @@ -123,17 +126,14 @@ class TemplatesController extends Controller { $provider = $providerWrapper->getProvider(); $providerAppId = $providerWrapper->getAppId(); - $options = $provider->getOptionsTemplate(); - $nav = []; - if (is_array($options) && array_key_exists('navigation', $options)) { - $nav = $options['navigation']; - } - + $searchTemplate = $provider->getSearchTemplate(); $ret[$providerAppId] = [ - 'provider' => $provider->getId(), - 'title' => $provider->getName(), - 'navigation' => $nav + 'provider' => $provider->getId(), + 'title' => $provider->getName(), + 'options' => $searchTemplate->getNavigationOptions(), + 'css' => $searchTemplate->getCss(), + 'icon' => $searchTemplate->getIcon() ]; } |