Skip to content

Commit fdfea7c

Browse files
Distribution: add example for hiding fields from the form. (#1833)
* Distribution: add example for hiding fields from the form. I am making a distribution for a client. * I don't want to show the description field because it should remain empty (at least that is how it is on their current Plone 4 site). * I don't want to show the default_language field, because I am setting this (and four available languages) in the Generic Setup profile. * Same for the portal_timezone: it is a site for Belgium, so I am setting Europe/Brussels in the Generic Setup profile, so this timezone is always set, even when a colleague in Portugal creates a site on his laptop. Unfortunately currently these fields have to be in the schema, as documented, otherwise you get an error. So instead I found out how to hide these fields. * make json snippet valid Co-authored-by: Steve Piercy <[email protected]> * indentation --------- Co-authored-by: Steve Piercy <[email protected]>
1 parent a63b51c commit fdfea7c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/developer-guide/create-a-distribution.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,30 @@ You may have noticed the entries for both `default_language` and `portal_timezon
245245
`plone.distribution` adds both definitions at runtime, providing a list of languages and timezones available on the installation.
246246
````
247247

248+
If you want to hide fields in the form, you can use the `uischema`.
249+
This is especially useful for fields that must be in the schema, but for which you always want the default value.
250+
The next lines hide three fields:
251+
252+
```json
253+
{
254+
"schema": {
255+
"…": ""
256+
},
257+
"uischema": {
258+
"description": {
259+
"ui:widget": "hidden"
260+
},
261+
"default_language": {
262+
"ui:widget": "hidden"
263+
},
264+
"portal_timezone": {
265+
"ui:widget": "hidden"
266+
}
267+
}
268+
}
269+
```
270+
271+
248272
## Add a dependency on an add-on
249273

250274
If you want to add a Plone backend add-on to your Plone distribution, then you must perform the following steps.

0 commit comments

Comments
 (0)