aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/md
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2021-02-04 11:11:33 +0100
committerGitHub <noreply@github.com>2021-02-04 11:11:33 +0100
commit9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c (patch)
tree97a618b77d327a5f963c91522988e24db5a9e158 /doc/md
parent8997ae6c8e24286f7d47981eaf905e80d2481c10 (diff)
parentbcba6bd353161fab456b423e93571ab027d5423c (diff)
downloadShaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.tar.gz
Shaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.tar.zst
Shaarli-9db1ccdf2ce8381e1f3acb581d3c6a6def095d8c.zip
Merge pull request #1698 from ArthurHoaro/feature/plugins-search-filterHEADmaster
New plugin hook: ability to add custom filters to Shaarli search engine
Diffstat (limited to 'doc/md')
-rw-r--r--doc/md/dev/Plugin-system.md19
1 files changed, 18 insertions, 1 deletions
diff --git a/doc/md/dev/Plugin-system.md b/doc/md/dev/Plugin-system.md
index 79654011..0ada57ea 100644
--- a/doc/md/dev/Plugin-system.md
+++ b/doc/md/dev/Plugin-system.md
@@ -27,7 +27,6 @@ You should have the following tree view:
27| |---| demo_plugin.php 27| |---| demo_plugin.php
28``` 28```
29 29
30
31### Plugin initialization 30### Plugin initialization
32 31
33At the beginning of Shaarli execution, all enabled plugins are loaded. At this point, the plugin system looks for an `init()` function in the <plugin_name>.php to execute and run it if it exists. This function must be named this way, and takes the `ConfigManager` as parameter. 32At the beginning of Shaarli execution, all enabled plugins are loaded. At this point, the plugin system looks for an `init()` function in the <plugin_name>.php to execute and run it if it exists. This function must be named this way, and takes the `ConfigManager` as parameter.
@@ -209,6 +208,7 @@ If it's still not working, please [open an issue](https://github.com/shaarli/Sha
209| [save_link](#save_link) | Allow to alter the link being saved in the datastore. | 208| [save_link](#save_link) | Allow to alter the link being saved in the datastore. |
210| [delete_link](#delete_link) | Allow to do an action before a link is deleted from the datastore. | 209| [delete_link](#delete_link) | Allow to do an action before a link is deleted from the datastore. |
211| [save_plugin_parameters](#save_plugin_parameters) | Allow to manipulate plugin parameters before they're saved. | 210| [save_plugin_parameters](#save_plugin_parameters) | Allow to manipulate plugin parameters before they're saved. |
211| [filter_search_entry](#filter_search_entry) | Add custom filters to Shaarli search engine |
212 212
213 213
214#### render_header 214#### render_header
@@ -565,6 +565,23 @@ the array will contain an entry with `MYPLUGIN_PARAMETER` as a key.
565 565
566Also [special data](#special-data). 566Also [special data](#special-data).
567 567
568#### filter_search_entry
569
570Triggered for *every* bookmark when Shaarli's BookmarkService method `search()` is used.
571Any custom filter can be added to filter out bookmarks from search results.
572
573The hook **must** return either:
574 - `true` to keep bookmark entry in search result set
575 - `false` to discard bookmark entry in result set
576
577> Note: custom filters are called *before* default filters are applied.
578
579##### Parameters
580
581- `Shaarli\Bookmark\Bookmark` object: entry to evaluate
582- $context `array`: additional information provided depending on what search is currently used,
583the user request, etc.
584
568## Guide for template designers 585## Guide for template designers
569 586
570### Plugin administration 587### Plugin administration