Skip to content

Commit 267fec0

Browse files
committed
Spruce up icons chapter
1 parent 255c876 commit 267fec0

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

docs/classic-ui/icons.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,18 @@ Plone ships with the following icon registrations by default.
4747
- [Toolbar](https://github.com/plone/plone.staticresources/blob/master/src/plone/staticresources/profiles/default/registry/icons_plone.xml)
4848

4949
The icons above are made available as Plone resources.
50-
For example, the icon registered as `lightning` (in XML with prefix full name is `plone.icon.lighting`) resource path is `++plone++bootstrap-icons/lightning.svg`.
50+
For example, the icon registered as `lightning` has the resource path of `++plone++bootstrap-icons/lightning.svg`.
51+
In XML, with its prefix, its full name is `plone.icon.lighting`.
5152
One could register another icon set under a new name, for example `++plone++fontawesome-icons`, and override the registrations above to use them.
5253

5354

5455
(classic-ui-icons-contextual-icons-label)=
5556

5657
## Contextual Icons
5758

58-
Plone defines contextual icons, which are used in specific places in a website.
59-
For example we have an icon registered under the name `plone.icon.plone-copy` in https://github.com/plone/plone.staticresources/blob/master/src/plone/staticresources/profiles/default/registry/icons_plone.xml which points to the bootstrap `clipboard-plus` icon `++plone++bootstrap-icons/clipboard-plus.svg`.
59+
Plone defines contextual icons which are used in specific places in a website.
60+
For example, we have an icon registered under the name `plone.icon.plone-copy` in `https://github.com/plone/plone.staticresources/blob/master/src/plone/staticresources/profiles/default/registry/icons_plone.xml`.
61+
It points to the bootstrap `clipboard-plus` icon `++plone++bootstrap-icons/clipboard-plus.svg`.
6062
To use a different icon than the system default, you can override the registration for `plone.icon.plone-copy` with another icon path.
6163

6264

@@ -68,27 +70,27 @@ To use a different icon than the system default, you can override the registrati
6870
How does this work? We need an example here!
6971
```
7072

71-
- The field `icon_expression` is used again to define icons for actions, contenttypes, and other purposes.
73+
- The field `icon_expression` is used again to define icons for actions, content types, and other purposes.
7274
- Use the icon name for icon expressions.
7375

7476

75-
(classic-ui-icons-iconresolver-label)=
77+
(classic-ui-icons-icon-resolver-label)=
7678

77-
## Iconresolver
79+
## Icon resolver
7880

79-
The iconresolver take's an icon name (without the `plone.icon.` prefix) like `plone-copy` or `align-center` and resolves it to an actual icon.
81+
The icon resolver takes an icon's name without the `plone.icon.` prefix, such as `plone-copy` or `align-center`, and resolves it to the URL of an actual icon.
8082

8183
```
8284
http://localhost:8080/Plone/@@iconresolver/plone-copy
8385
http://localhost:8080/Plone/@@iconresolver/align-center
8486
```
8587

86-
The iconresolver can be used via URL or via Python as shown in section {ref}`classic-ui-icons-iconresolver-get-icon-url-label` and {ref}`classic-ui-icons-iconresolver-get-icon-tag-label`.
88+
The icon resolver can be used to get an icon's URL or an inline icon (or tag) via a Python expression as shown in the sections {ref}`classic-ui-icons-icon-resolver-get-icon-url-label` and {ref}`classic-ui-icons-icon-resolver-get-icon-tag-label`.
8789

8890

89-
(classic-ui-icons-iconresolver-get-icon-url-label)=
91+
(classic-ui-icons-icon-resolver-get-icon-url-label)=
9092

91-
### Get icon URL via Python expression
93+
### Get an icon's URL via Python expression
9294

9395
The `url` method of the `@@iconresolver` view returns the actual URL to the SVG icon.
9496
The icon resolver view is globally available in templates under the name `icons`.
@@ -101,7 +103,7 @@ This can be used in a template for an `img` tag:
101103
```
102104

103105

104-
(classic-ui-icons-iconresolver-get-icon-tag-label)=
106+
(classic-ui-icons-icon-resolver-get-icon-tag-label)=
105107

106108
### Get an inline icon (tag) via Python expression
107109

@@ -118,12 +120,14 @@ Inline icons can be styled via CSS.
118120
tal:replace="structure python:icons.tag('archive', tag_class='custom-class', tag_alt='foobar')" />
119121
```
120122

121-
### Get inline icon (tag) in a template via traverse
123+
124+
### Get inline icon (tag) in a template via traversal
122125

123126
```xml
124127
<tal:icon tal:replace="structure icons/alarm" />
125128
```
126129

130+
127131
### Get an inline icon (tag) in JavaScript
128132

129133
```js
@@ -138,9 +142,9 @@ if(baseUrl){
138142
}
139143
```
140144

141-
[Mockup](https://github.com/plone/mockup) provides an `iconResolver` function, defined in `core/utils.js`, which does this the same way and has a fallback for demo and testing.
142-
143-
145+
[Mockup](https://github.com/plone/mockup) provides an `iconResolver` function, defined in `core/utils.js`
146+
This function resolves icons the same way.
147+
It also has a fallback for demo and testing.
144148

145149

146150
(classic-ui-icons-iconresolver-fallback-label)=
@@ -151,6 +155,6 @@ There is a Plone icon defined as `fallback` if the name of the icon cannot be fo
151155

152156
Fallbacks are grouped, such as [`mimetype icons`](https://github.com/plone/plone.staticresources/blob/master/src/plone/staticresources/profiles/default/registry/icons_mimetype.xml).
153157

154-
For example, the JPEG icon is in this group and is in the mimetype group and is named `mimetype-image/jpeg`.
158+
For example, the JPEG icon is in this group, as well as the mimetype group, and is named `mimetype-image/jpeg`.
155159
You can also register specific image icons.
156160
If there is no specific icon in that group, then `mimetype-image` is used as the fallback.

0 commit comments

Comments
 (0)