return $data;
+#### Special data
+
+Special additional data are passed to every hook through the
+`$data` parameter to give you access to additional context, and services.
+
+Complete list:
+
+ * `_PAGE_` (string): if the current hook is used to render a template, its name is passed through this additional parameter.
+ * `_LOGGEDIN_` (bool): whether the user is logged in or not.
+ * `_BASE_PATH_` (string): if Shaarli instance is hosted under a subfolder, contains the subfolder path to `index.php` (e.g. `https://domain.tld/shaarli/` -> `/shaarli/`).
+ * `_BOOKMARK_SERVICE_` (`BookmarkServiceInterface`): bookmark service instance, for advanced usage.
+
+Example:
+
+```php
+if ($data['_PAGE_'] === TemplatePage::LINKLIST && $data['LOGGEDIN'] === true) {
+ // Do something for logged in users when the link list is rendered
+}
+```
+
#### Filling templates placeholder
Template placeholders are displayed in template in specific places.
The data contained by this array can be altered before template rendering.
-For exemple, in linklist, it is possible to alter every title:
+For example, in linklist, it is possible to alter every title:
```php
// mind the reference if you want $data to be altered
`$data` is an array containing:
-- `_PAGE_`: current target page (eg: `linklist`, `picwall`, etc.).
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_PAGE_`: current target page (eg: `linklist`, `picwall`, etc.).
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_PAGE_`: current target page (eg: `linklist`, `picwall`, etc.).
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
-- All templates data, including links.
+ - All templates data, including links.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- All templates data.
+ - All templates data.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- All templates data.
+ - All templates data.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
-- All templates data.
+ - All templates data.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
-- All templates data.
+ - All templates data.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
-- All templates data.
+ - All templates data.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
-- All templates data, including links.
+ - All templates data, including links.
+ - [Special data](#special-data)
##### Template placeholders
`$data` is an array containing:
-- `_LOGGEDIN_`: true if user is logged in, false otherwise.
-- `_PAGE_`: containing either `rss` or `atom`.
-- All templates data, including links.
+ - All templates data, including links.
+ - [Special data](#special-data)
##### Template placeholders
- created
- updated
+Also [special data](#special-data).
+
#### delete_link
##### Data
-`$data` is an array containing the link being saved:
+`$data` is an array containing the link being deleted:
- id
- title
- created
- updated
+Also [special data](#special-data).
#### save_plugin_parameters
So if the plugin has a parameter called `MYPLUGIN_PARAMETER`,
the array will contain an entry with `MYPLUGIN_PARAMETER` as a key.
+Also [special data](#special-data).
## Guide for template designer