xref: /plugin/pagesicon/README_EN.md (revision b603bbe1e83f2122ab63b4df278133cf619e6be8)
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
31## What the helper provides
32
33Load helper:
34
35```php
36$pagesicon = plugin_load('helper', 'pagesicon');
37```
38
39Main methods:
40
41- `getPageIconId()`: returns the media ID of a page icon
42- `getMediaIconId()`: returns the media ID of the icon associated with a media file
43- `getPageIconUrl()`: returns the versioned URL of a page icon
44- `getMediaIconUrl()`: returns the versioned URL of the icon associated with a media file
45- `getDefaultIconUrl()`: returns the URL of the default image to use when no icon is found
46- `getUploadIconPage()`: returns the icon management URL for a page
47- `getUploadMediaIconPage()`: returns the icon management URL for a media file
48- `notifyIconUpdated()`: notifies other plugins that an icon changed
49
50## Cache and integrations
51
52When an icon is modified, the plugin triggers the `PLUGIN_PAGESICON_UPDATED` event.
53
54This allows other plugins to refresh or invalidate their own cache when needed.
55