xref: /plugin/pagesicon/README_EN.md (revision 19821f1cafeaa8d92e984e47c4c84aa90423d907)
1# Pagesicon
2
3I really like DokuWiki, but I always found it a bit sad: there was no simple way to add nice icons to pages.
4With **pagesicon**, this is now possible.
5
6The plugin can:
7- display an icon at the top of the page (`show`);
8- use this icon as the browser tab favicon (`show_as_favicon`);
9- provide an icon management page with `?do=pagesicon`;
10- handle `big` and `small` variants depending on the context;
11- expose a helper (reusable API) for other plugins.
12
13## Usage
14
15From a page, use the `Manage icon` action to:
16- upload a `big` icon;
17- upload a `small` icon;
18- delete the current icon.
19
20## Configuration
21
22In the configuration manager:
23- `icon_name`: candidate filenames for the `big` icon, separated by `;`, with support for `~pagename~`
24- `icon_thumbnail_name`: candidate filenames for the `small` icon, separated by `;`, with support for `~pagename~`
25- `default_image`: default image used only when a helper method explicitly asks for a fallback
26- `icon_size`: size of the icon displayed at the top of the page
27- `extensions`: allowed extensions, for example `svg;png;jpg;jpeg`
28- `show_on_top`: displays the icon in the page
29- `show_as_favicon`: uses the icon as favicon
30- `parent_fallback`: allows using a parent icon when the page has none
31
32## What the helper provides
33
34Load helper:
35
36```php
37$pagesicon = plugin_load('helper', 'pagesicon');
38```
39
40Main methods:
41
42- `getPageIconId()`: returns the media ID of a page icon
43- `getMediaIconId()`: returns the media ID of the icon associated with a media file
44- `getPageIconUrl()`: returns the versioned URL of a page icon
45- `getMediaIconUrl()`: returns the versioned URL of the icon associated with a media file
46- `getDefaultIconUrl()`: returns the URL of the default image to use when no icon is found
47- `getUploadIconPage()`: returns the icon management URL for a page
48- `getUploadMediaIconPage()`: returns the icon management URL for a media file
49- `notifyIconUpdated()`: notifies other plugins that an icon changed
50
51## Cache and integrations
52
53When an icon is modified, the plugin triggers the `PLUGIN_PAGESICON_UPDATED` event.
54
55This allows other plugins to refresh or invalidate their own cache when needed.
56
57## Icon inheritance
58
59If no icon is found on the page itself, the plugin can also:
60- inherit no icon;
61- use the direct parent icon;
62- use the first icon found while walking up parent namespaces.
63