From bcba6bd353161fab456b423e93571ab027d5423c Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 20 Jan 2021 15:59:00 +0100 Subject: New plugin hook: ability to add custom filters to Shaarli search engine A new plugin hook has been added: hook_test_filter_search_entry This hook allows to filter out bookmark with custom plugin code when a search is performed. Related to #143 --- application/bookmark/BookmarkFileService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'application/bookmark/BookmarkFileService.php') diff --git a/application/bookmark/BookmarkFileService.php b/application/bookmark/BookmarkFileService.php index 8ea37427..e64eeafb 100644 --- a/application/bookmark/BookmarkFileService.php +++ b/application/bookmark/BookmarkFileService.php @@ -15,6 +15,7 @@ use Shaarli\Formatter\BookmarkMarkdownFormatter; use Shaarli\History; use Shaarli\Legacy\LegacyLinkDB; use Shaarli\Legacy\LegacyUpdater; +use Shaarli\Plugin\PluginManager; use Shaarli\Render\PageCacheManager; use Shaarli\Updater\UpdaterUtils; @@ -40,6 +41,9 @@ class BookmarkFileService implements BookmarkServiceInterface /** @var ConfigManager instance */ protected $conf; + /** @var PluginManager */ + protected $pluginManager; + /** @var History instance */ protected $history; @@ -57,6 +61,7 @@ class BookmarkFileService implements BookmarkServiceInterface */ public function __construct( ConfigManager $conf, + PluginManager $pluginManager, History $history, Mutex $mutex, bool $isLoggedIn @@ -95,7 +100,8 @@ class BookmarkFileService implements BookmarkServiceInterface } } - $this->bookmarkFilter = new BookmarkFilter($this->bookmarks, $this->conf); + $this->pluginManager = $pluginManager; + $this->bookmarkFilter = new BookmarkFilter($this->bookmarks, $this->conf, $this->pluginManager); } /** -- cgit v1.2.3