FEATURE: add registering for new search engines.

This commit is contained in:
Michal Kváček
2016-03-14 17:10:14 +01:00
parent a237133227
commit 8a94f1dbab
6 changed files with 154 additions and 0 deletions
+18
View File
@@ -2,9 +2,12 @@
namespace App\Providers;
use App\Handlers\Registrators\SearchEngineRegistrator;
use App\Handlers\Registrators\SettingsExtensionRegistrator;
use App\Handlers\Registrators\TemplateRegistrator;
use App\Handlers\Registrators\WidgetRegistrator;
use App\Handlers\Search\Content;
use App\Handlers\Search\Presenters\Content as ContentPresenter;
use App\Widgets\HtmlCode\HtmlCode;
use Illuminate\Support\ServiceProvider;
@@ -20,6 +23,7 @@ class AppServiceProvider extends ServiceProvider
$this->registerWidgets();
$this->registerTemplates();
$this->registerSettings();
$this->registerSearch();
}
/**
@@ -51,6 +55,10 @@ class AppServiceProvider extends ServiceProvider
$this->app->singleton('registerSettingsExtension', function ($app) {
return new SettingsExtensionRegistrator($app);
});
$this->app->singleton('registerSearchEngine', function ($app) {
return new SearchEngineRegistrator($app);
});
}
/**
@@ -91,4 +99,14 @@ class AppServiceProvider extends ServiceProvider
$registrator->register('basic', 'admin/settings.basic', 'admin.settings.parts.basic');
$registrator->register('meta', 'admin/settings.meta', 'admin.settings.parts.meta');
}
/**
* Register callbacks used for searching
*/
private function registerSearch()
{
$registrator = $this->app->make('registerSearchEngine');
$registrator->register(new Content(), new ContentPresenter());
}
}