-#Plugin System
-[**I am a developer.** Developer API.](#developer-api)[](.html)
+[**I am a developer.** Developer API.](#developer-api)
-[**I am a template designer.** Guide for template designer.](#guide-for-template-designer)[](.html)
+[**I am a template designer.** Guide for template designer.](#guide-for-template-designer)
## Developer API
Parameters:
- - data: see [$data section](https://github.com/shaarli/Shaarli/wiki/Plugin-System#plugins-data)[](.html)
+ - data: see [$data section](https://github.com/shaarli/Shaarli/wiki/Plugin-System#plugins-data)
- conf: the `ConfigManager` instance.
For exemple, if my plugin want to add data to the header, this function is needed:
For example, let's add a value in the placeholder `top_placeholder` which is displayed at the top of my page:
```php
-$data['top_placeholder'[] = 'My content';](]-=-'My-content';.html)
+$data['top_placeholder'][] = 'My content';
# OR
-array_push($data['top_placeholder'], 'My', 'content');[](.html)
+array_push($data['top_placeholder'], 'My', 'content');
return $data;
```
```php
// mind the reference if you want $data to be altered
-foreach ($data['links'] as &$value) {[](.html)
+foreach ($data['links'] as &$value) {
// String reverse every title.
- $value['title'] = strrev($value['title']);[](.html)
+ $value['title'] = strrev($value['title']);
}
return $data;
Use `demo_plugin` as a functional example. It covers most of the plugin system features.
-If it's still not working, please [open an issue](https://github.com/shaarli/Shaarli/issues/new).[](.html)
+If it's still not working, please [open an issue](https://github.com/shaarli/Shaarli/issues/new).
### Hooks
| Hooks | Description |
| ------------- |:-------------:|
-| [render_header](#render_header) | Allow plugin to add content in page headers. |[](.html)
-| [render_includes](#render_includes) | Allow plugin to include their own CSS files. |[](.html)
-| [render_footer](#render_footer) | Allow plugin to add content in page footer and include their own JS files. | [](.html)
-| [render_linklist](#render_linklist) | It allows to add content at the begining and end of the page, after every link displayed and to alter link data. |[](.html)
-| [render_editlink](#render_editlink) | Allow to add fields in the form, or display elements. |[](.html)
-| [render_tools](#render_tools) | Allow to add content at the end of the page. |[](.html)
-| [render_picwall](#render_picwall) | Allow to add content at the top and bottom of the page. |[](.html)
-| [render_tagcloud](#render_tagcloud) | Allow to add content at the top and bottom of the page, and after all tags. |[](.html)
-| [render_taglist](#render_taglist) | Allow to add content at the top and bottom of the page, and after all tags. |[](.html)
-| [render_daily](#render_daily) | Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. |[](.html)
-| [render_feed](#render_feed) | Allow to do add tags in RSS and ATOM feeds. |[](.html)
-| [save_link](#save_link) | Allow to alter the link being saved in the datastore. |[](.html)
-| [delete_link](#delete_link) | Allow to do an action before a link is deleted from the datastore. |[](.html)
+| [render_header](#render_header) | Allow plugin to add content in page headers. |
+| [render_includes](#render_includes) | Allow plugin to include their own CSS files. |
+| [render_footer](#render_footer) | Allow plugin to add content in page footer and include their own JS files. |
+| [render_linklist](#render_linklist) | It allows to add content at the begining and end of the page, after every link displayed and to alter link data. |
+| [render_editlink](#render_editlink) | Allow to add fields in the form, or display elements. |
+| [render_tools](#render_tools) | Allow to add content at the end of the page. |
+| [render_picwall](#render_picwall) | Allow to add content at the top and bottom of the page. |
+| [render_tagcloud](#render_tagcloud) | Allow to add content at the top and bottom of the page, and after all tags. |
+| [render_taglist](#render_taglist) | Allow to add content at the top and bottom of the page, and after all tags. |
+| [render_daily](#render_daily) | Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. |
+| [render_feed](#render_feed) | Allow to do add tags in RSS and ATOM feeds. |
+| [save_link](#save_link) | Allow to alter the link being saved in the datastore. |
+| [delete_link](#delete_link) | Allow to do an action before a link is deleted from the datastore. |
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `buttons_toolbar`: after the list of buttons in the header.
-![buttons_toolbar_example](http://i.imgur.com/ssJUOrt.png)[](.html)
+![buttons_toolbar_example](http://i.imgur.com/ssJUOrt.png)
* `fields_toolbar`: after search fields in the header.
> Note: This will only be called in linklist.
-![fields_toolbar_example](http://i.imgur.com/3GMifI2.png)[](.html)
+![fields_toolbar_example](http://i.imgur.com/3GMifI2.png)
#### render_includes
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `text`: called after the end of the footer text.
* `endofpage`: called at the end of the page.
-![text_example](http://i.imgur.com/L5S2YEH.png)[](.html)
+![text_example](http://i.imgur.com/L5S2YEH.png)
* `js_files`: called at the end of the page, to include custom JS scripts.
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `action_plugin`: next to the button "private only" at the top and bottom of the page.
-![action_plugin_example](http://i.imgur.com/Q12PWg0.png)[](.html)
+![action_plugin_example](http://i.imgur.com/Q12PWg0.png)
* `link_plugin`: for every link, between permalink and link URL.
-![link_plugin_example](http://i.imgur.com/3oDPhWx.png)[](.html)
+![link_plugin_example](http://i.imgur.com/3oDPhWx.png)
* `plugin_start_zone`: before displaying the template content.
-![plugin_start_zone_example](http://i.imgur.com/OVBkGy3.png)[](.html)
+![plugin_start_zone_example](http://i.imgur.com/OVBkGy3.png)
* `plugin_end_zone`: after displaying the template content.
-![plugin_end_zone_example](http://i.imgur.com/6IoRuop.png)[](.html)
+![plugin_end_zone_example](http://i.imgur.com/6IoRuop.png)
#### render_editlink
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `edit_link_plugin`: after tags field.
-![edit_link_plugin_example](http://i.imgur.com/5u17Ens.png)[](.html)
+![edit_link_plugin_example](http://i.imgur.com/5u17Ens.png)
#### render_tools
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `tools_plugin`: at the end of the page.
-![tools_plugin_example](http://i.imgur.com/Bqhu9oQ.png)[](.html)
+![tools_plugin_example](http://i.imgur.com/Bqhu9oQ.png)
#### render_picwall
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `plugin_end_zone`: after displaying the template content.
-![plugin_start_end_zone_example](http://i.imgur.com/tVTQFER.png)[](.html)
+![plugin_start_end_zone_example](http://i.imgur.com/tVTQFER.png)
#### render_tagcloud
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `tag_plugin`: after each tag
-![plugin_start_end_zone_example](http://i.imgur.com/vHmyT3a.png)[](.html)
+![plugin_start_end_zone_example](http://i.imgur.com/vHmyT3a.png)
#### render_taglist
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
##### Template placeholders
-Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.[](.html)
+Items can be displayed in templates by adding an entry in `$data['<placeholder>']` array.
List of placeholders:
* `link_plugin`: used at bottom of each link.
-![link_plugin_example](http://i.imgur.com/hzhMfSZ.png)[](.html)
+![link_plugin_example](http://i.imgur.com/hzhMfSZ.png)
* `plugin_start_zone`: before displaying the template content.
##### Template placeholders
-Tags can be added in feeds by adding an entry in `$data['<placeholder>']` array.[](.html)
+Tags can be added in feeds by adding an entry in `$data['<placeholder>']` array.
List of placeholders: