Skip to content

Commit ea9618c

Browse files
committed
Merge branch '6.0' into linkcheck-news-volto
2 parents 978ca5c + ba580d1 commit ea9618c

File tree

14 files changed

+186
-124
lines changed

14 files changed

+186
-124
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "submodules/volto"]
22
path = submodules/volto
33
url = https://github.com/plone/volto.git
4-
branch = master
4+
branch = main
55
[submodule "submodules/plone.restapi"]
66
path = submodules/plone.restapi
77
url = https://github.com/plone/plone.restapi.git

docs/backend/content-types/index.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ myst:
99

1010
(backend-content-types-label)=
1111

12-
# Content Types
12+
# Content types
13+
14+
This part of the documentation describes how to develop content types in Plone.
15+
Content types are implemented through the {term}`Dexterity` framework.
1316

14-
```{seealso}
15-
See the chapter {ref}`training:dexterity1-label` from the Mastering Plone 6 Training for a step-by-step tutorial to create a custom content type.
16-
```
1717

1818
## What is a content type?
1919

@@ -22,19 +22,59 @@ We have different content types to reflect the different kinds of information ab
2222

2323
Pages, news items, events, files (binary), and images are examples of content types.
2424

25-
Lots of things in Plone can be configured to work differently based on the content type. For example, each content type has:
26-
- a {ref}`schema <backend-fields-label>` specifying the fields which can be edited for the content type
27-
- a list of {ref}`behaviors <backend-behaviors-label>` which supply additional functionality that can be attached to the content types for which the behavior is enabled
28-
- a {ref}`workflow <backend-workflows-label>` controlling transitions between publishing states and associated permissions
29-
- a version policy controlling whether to store a revision history
25+
Lots of things in Plone can be configured to work differently based on the content type.
26+
For example, each content type has:
27+
28+
- a {ref}`schema <backend-fields-label>` specifying the fields which can be edited for the content type
29+
- a list of {ref}`behaviors <backend-behaviors-label>` which supply additional functionality that can be attached to the content types for which the behavior is enabled
30+
- a {ref}`workflow <backend-workflows-label>` controling transitions between publishing states and associated permissions
31+
- a version policy controling whether to store a revision history
3032

3133
It is common in developing a web site that you'll need customized versions of common content types, or perhaps even entirely new types.
3234

35+
36+
## Topics
37+
38+
This part of the documentation will cover the following topics.
39+
40+
- Some basic design techniques for solving problems with content types in Plone
41+
- Setting up a Dexterity development environment
42+
- Creating a package to house your types
43+
- Building a custom type based on a schema
44+
- Creating custom views and forms for your type
45+
- Advanced customization, including workflow and security
46+
- Testing your types
47+
- A quick reference to common fields, widgets, and APIs
48+
49+
```{seealso}
50+
See the chapter {ref}`training:dexterity1-label` from the Mastering Plone 6 Training for a step-by-step tutorial to create a custom content type.
51+
```
52+
53+
```{toctree}
54+
:maxdepth: 2
55+
```
56+
% Uncomment each of the following and move into the toctree above when migrated from Plone 5 documentation
57+
% designing
58+
% prerequisite
59+
% schema-driven-types
60+
% model-driven-types
61+
% custom-views
62+
% advanced/index
63+
% testing/index
64+
% reference/index
65+
66+
3367
## Factory Type Information
3468

69+
```{todo}
70+
Find a new home for this section.
71+
This page is an introduction, whereas FTI is a topic unto itself.
72+
```
73+
3574
A content type is defined by creating a {term}`Factory Type Information` (FTI) object.
3675

37-
To create an FTI in a GenericSetup profile, add the content type to the list in `types.xml`. For example, this adds the standard Plone page (Document) content type:
76+
To create an FTI in a `GenericSetup` profile, add the content type to the list in `types.xml`.
77+
For example, this adds the standard Plone page (`Document`) content type:
3878

3979
```xml
4080
<object name="portal_types">
@@ -145,7 +185,8 @@ In this example, the file is `types/Document.xml` and contains this XML:
145185

146186
The `name` attribute on the root element in the XML must match the name in the filename and the name listed in `types.xml`.
147187

148-
Set the `i18n:domain` to the i18n domain which includes translations for this content type. This is usually the same as the name of the Python package which contains the content type.
188+
Set the `i18n:domain` to the i18n domain which includes translations for this content type.
189+
This is usually the same as the name of the Python package which contains the content type.
149190

150191

151192
(global-fti-properties-label)=
@@ -209,7 +250,6 @@ The XML sets a number of FTI properties that are used globally, in both Classic
209250
: The name of the content type displayed in the UI.
210251

211252

212-
213253
(classic-ui-only-fti-properties-label)=
214254

215255
### Classic UI only FTI properties

docs/classic-ui/images.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,15 @@ Or you can get the HTML tag back, and replace the current tag with it:
199199

200200
```xml
201201
<div tal:define="scale_view context/@@images">
202-
<img tal:replace="structured python: scale_view.tag('image', 'mini')">
202+
<img tal:replace="structure python: scale_view.tag('image', 'mini')">
203203
</div>
204204
```
205205

206206
You can also provide the following keyword arguments to set `title`, `alt`, or `css_class` for the generated tag:
207207

208208
```xml
209209
<div tal:define="scale_view context/@@images">
210-
<img tal:replace="structured python: scale_view.tag('banner', 'mini', title='The Banner', alt='Alternative text', css_class='banner')">
210+
<img tal:replace="structure python: scale_view.tag('banner', 'mini', title='The Banner', alt='Alternative text', css_class='banner')">
211211
</div>
212212
```
213213

@@ -460,3 +460,53 @@ This will result in a `srcset` as in the following example for a medium image:
460460
Please note that this example has the `resolve_uid_and_caption` filter disabled to see the scale names better.
461461
The real `src` URLs look more like `http://localhost:8080/Plone50/dsc04791.jpg/@@images/778f9c06-36b0-485d-ab80-12c623dc4bc3.jpeg`.
462462
```
463+
464+
## Image scales from catalog brain
465+
466+
For all `NamedBlobImage` fields, we can get existing scale information directly from the catalog brain.
467+
468+
Given a content type with a `NamedBlobField` named `picture`, we can get the following information by calling the `image_scales` attribute on the catalog brain.
469+
470+
```python
471+
(Pdb) pp brain.image_scales
472+
{'picture': [{'content-type': 'image/jpeg',
473+
'download': '@@images/picture-800-ddae07fbc46b293155bd6fcda7f2572a.jpeg',
474+
'filename': 'my-picture.jpg',
475+
'height': 800,
476+
'scales': {'icon': {'download': '@@images/picture-32-f2f815374aa5434e06fb3a95306527fd.jpeg',
477+
'height': 32,
478+
'width': 32},
479+
'large': {'download': '@@images/picture-800-4dab3b3cc42abb6fad29258c7430070a.jpeg',
480+
'height': 800,
481+
'width': 800},
482+
'listing': {'download': '@@images/picture-16-d3ac2117158cf38d0e15c5f5feb8b75d.jpeg',
483+
'height': 16,
484+
'width': 16},
485+
'mini': {'download': '@@images/picture-200-3de96ae4288dfb18f5589c89b861ecc1.jpeg',
486+
'height': 200,
487+
'width': 200},
488+
'preview': {'download': '@@images/picture-400-60f60942c8e4ddd7dcdfa90527a8bae0.jpeg',
489+
'height': 400,
490+
'width': 400},
491+
'teaser': {'download': '@@images/picture-600-1ada88b8af6748e9cbe18a34c3127443.jpeg',
492+
'height': 600,
493+
'width': 600},
494+
'thumb': {'download': '@@images/picture-128-80fce253497f7a745315f58f3e8f3a0c.jpeg',
495+
'height': 128,
496+
'width': 128},
497+
'tile': {'download': '@@images/picture-64-220d6703eac104c59774a379a8276e76.jpeg',
498+
'height': 64,
499+
'width': 64}},
500+
'size': 238977,
501+
'width': 800}]}
502+
```
503+
504+
This information shows we have everything we need to generate our image URLs, without waking up any objects.
505+
506+
```xml
507+
<li tal:define="preview python: brain.image_scales['picture'][0]['scales']['preview']">
508+
<img src="${brain/getURL}/${python: preview['download']}"
509+
width="${python: preview['width']}"
510+
height="${python: preview['height']}" />
511+
</li>
512+
```

docs/classic-ui/layers.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,8 @@ Then views and viewlets from your product can be enabled on the site instance us
5858
### Unconditional overrides
5959

6060
If you want to override a view or a viewlet unconditionally for all sites without the add-on product installer support, you need to use `overrides.zcml`.
61-
62-
```{todo}
63-
Explain how to use an `overrides.zcml`.
64-
65-
See https://github.com/plone/documentation/issues/1426
66-
```
61+
You can override classes and templates in this file.
62+
To do this, you put the ZCML registration in a file called `overrides.zcml` in the package root, next to the top-most `configure.zcml`.
6763

6864

6965
(classic-ui-creating-a-layer-label)=

docs/classic-ui/views.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ You need to declare the `browser` namespace in your `configure.zcml` to use `bro
173173
```
174174

175175
The view in question is registered against a {ref}`layer <classic-ui-layers-label>`.
176-
It will be available after restart, after running the {ref}`GenericSetup profile <backend-configuration-registry-generic-setup-label>`.
176+
It will be available after restart and running the {ref}`GenericSetup profile <backend-configuration-registry-generic-setup-label>`, or enabling the add-on.
177177

178178

179179
(classic-ui-page-template-label)=
@@ -432,7 +432,7 @@ Since one Zope application server can contain multiple Plone sites, layers are u
432432
A layer is in use when either:
433433

434434
- a theme which defines that layer is active, or
435-
- if a specific add-on product which defines that layer is installed.
435+
- if a specific add-on product which defines that layer is installed in the Plone site.
436436

437437
You should register your views against a certain layer in your own code.
438438

@@ -637,11 +637,11 @@ This way you also have a test for the generated view.
637637

638638
## Guided information
639639

640-
The Mastering Plone Training has several chapters on views.
640+
The Mastering Plone 5 Training has several chapters on views.
641641

642-
- {ref}`training:views1-label`
643-
- {ref}`training:views2-label`
644-
- {ref}`training:views3-label`
642+
- {doc}`training:mastering-plone-5/views_1`
643+
- {doc}`training:mastering-plone-5/views_2`
644+
- {doc}`training:mastering-plone-5/views_3`
645645

646646

647647
(classic-ui-anatomy-of-a-view-label)=

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
r"https://coveralls.io/repos/github/plone/plone.restapi/badge.svg\?branch=main", # plone.restapi
9292
r"https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors#Identifying_the_issue",
9393
r"https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0", # volto
94+
# Ignore unreliable sites
95+
r"https://web.archive.org/", # volto
9496
]
9597
linkcheck_anchors = True
9698
linkcheck_timeout = 5
@@ -324,7 +326,7 @@ def source_replace(app, docname, source):
324326
# Dict of replacements.
325327
source_replacements = {
326328
"{PLONE_BACKEND_MINOR_VERSION}": "6.0",
327-
"{PLONE_BACKEND_PATCH_VERSION}": "6.0.6",
329+
"{PLONE_BACKEND_PATCH_VERSION}": "6.0.7",
328330
"{NVM_VERSION}": "0.39.3",
329331
}
330332

docs/glossary.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ Diazo
121121
Diazo allows you to apply a theme contained in a static HTML web page to a dynamic website created using any server-side technology.
122122
123123
Dexterity
124-
[Dexterity](https://github.com/plone/plone.dexterity), the base framework for building content types, both through-the-web and as filesystem code for Zope.
124+
[Dexterity](https://github.com/plone/plone.dexterity) is the base framework for building content types, both through-the-web and as filesystem code.
125+
It is aimed at Plone, although this package should work with plain Zope + CMF systems.
125126
126127
Dublin Core
127128
The Dublin Core Schema is a small set of vocabulary terms that can be used to describe web resources (video, images, web pages, etc.), as well as physical resources such as books or CDs, and objects like artworks.
@@ -515,7 +516,7 @@ Zope Component Architecture
515516
It can be used for developing any Python application.
516517
Maybe it should be called Python Component Architecture.
517518
```{seealso}
518-
See also https://muthukadan.net/docs/zca.html.
519+
See also https://zopecomponent.readthedocs.io/en/latest/index.html.
519520
```
520521
521522
browser layer

docs/i18n-l10n/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ language tag
6262
: A language tag is a string used as an identifier for a language.
6363
A language tag may have one or more subtags.
6464
The basic form of a language tag is `LANGUAGE-[SUBTAG]`.
65-
65+
6666
```{seealso}
6767
- W3C article [Language tags in HTML and XML](https://www.w3.org/International/articles/language-tags/)
6868
- W3C Working Draft [Language Tags and Locale Identifiers for the World Wide Web](https://www.w3.org/TR/ltli/)
@@ -145,6 +145,7 @@ These differences depend upon the programming language, either Python or JavaScr
145145
146146
translating-text-strings
147147
language-negotiation
148+
language-negotiation-volto
148149
translating-content
149150
contributing-translations
150151
resync-translations
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "Accessing and changing the language state of Plone programmatically."
5+
"property=og:description": "Accessing and changing the language state of Plone programmatically."
6+
"property=og:title": "Language negotiation in Volto"
7+
"keywords": "Plone, Internationalization, i18n, language, negotiation, translation, localization, volto"
8+
---
9+
10+
(language-negotiation-volto-label)=
11+
12+
# Language negotiation in Volto
13+
14+
Volto does not rely on the configuration set in Plone's Language Control Panel to handle the redirection from the root of the site to the Language Root Folder.
15+
16+
Volto has a setting in its own configuration stating whether a site is multilingual or not: `isMultilingual`.
17+
18+
First of all, you need to set that setting to `true`.
19+
20+
Then you need to add the list of supported languages to the `supportedLanguages` setting, and match them with the languages configured in Plone's Language Control Panel.
21+
22+
As a last thing, you need to set your site's `defaultLanguage` to one of the `supportedLanguages`.
23+
24+
When all these settings are configured, Volto's [`MultilingualRedirector`](https://github.com/plone/volto/blob/main/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx) will handle the language negotiation and the redirect.
25+
26+
In its configuration, the component tries to match the `I18N_LANGUAGE` cookie set in the user's browser with the list of supported languages, and if the match does not succeed, it selects the default language configured in Volto.
27+
28+
After that it does the redirection to the matched Language Root Folder.
29+
30+
If the site is not configured to be multilingual, Volto doesn't do any redirect.
31+
32+
## Overriding the default behavior
33+
34+
To do so, you need to provide your own `MultilingualRedirector` component {doc}`customizing it </volto/recipes/customizing-components>`.

0 commit comments

Comments
 (0)