Skip to content

Commit 7a37e62

Browse files
committed
Fix some syntax and add more content
1 parent cfc4080 commit 7a37e62

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

docs/backend/global-utils.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ html_meta:
33
"description": "Global functions defined in CMFPlone and plone.app.layout."
44
"property=og:description": "Global functions defined in CMFPlone and plone.app.layout."
55
"property=og:title": "Global utils and helpers"
6-
"keywords": "global variables,portal_state,context_state,plone_view,portal_url,helper methods"
6+
"keywords": "Plone, Classic UI, templates, global variables, portal_state, context_state, plone_view, portal_url, helper methods"
77
---
88

99

docs/classic-ui/templates-global-variables.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,49 @@ html_meta:
1010

1111
For convenience Plone defines a couple of global variables often used in templates.
1212

13-
- [`portal_state`](backend-global-utils-portal-state-label)
14-
- [`context_state`](backend-global-utils-context-state-label)
15-
- [`plone_view`](backend-global-utils-plone-view-label)
16-
- `icons`
13+
- {ref}`backend-global-utils-portal-state-label`
14+
- {ref}`backend-global-utils-context-state-label`
15+
- {ref}`backend-global-utils-plone-view-label`
16+
- {ref}`icons <classic-ui-icons-icon-resolver-label>`
1717
- `lang`
18-
- `portal_url`
19-
- `checkPermission`
18+
- {ref}`classic-ui-templates-global-variables-portal-url-label`
19+
- {ref}`classic-ui-templates-global-variables-check-permissions`
2020
- `ajax_include_head`
2121
- `isAnon`
22+
23+
24+
(classic-ui-templates-global-variables-portal-url-label)=
25+
26+
## `portal_url`
27+
28+
`portal_url` will return the portal URL.
29+
It can be used as follows:
30+
31+
```xml
32+
<a href="${portal_url}/@@overview-controlpanel>Overview Controlpanel</a>
33+
```
34+
35+
It is basically a short cut for:
36+
37+
```xml
38+
<div tal:define="portal_url python: portal_state.portal_url()">
39+
<a href="${portal_url}/@@overview-controlpanel">Overview Controlpanel</a>
40+
</div>
41+
```
42+
43+
44+
(classic-ui-templates-global-variables-check-permissions)=
45+
46+
## `checkPermission`
47+
48+
`checkPermission` will return the checkPermission method from portal_membership tool.
49+
50+
It can be used as follows to check for user permissions in templates:
51+
52+
```xml
53+
<div tal:condition="python: checkPermission('Modify portal content', context)">
54+
<span tal:omit-tag="">
55+
You see this page because you have permission to edit this.
56+
</span>
57+
</div>
58+
```

0 commit comments

Comments
 (0)