Skip to content

Commit 2cdffc6

Browse files
authored
Add terms to Glossary for block extension examples (#1829)
* Add terms for block extension examples * Revise variation definition * Add higher-order component (HOC) definition
1 parent d43b247 commit 2cdffc6

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/glossary.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,32 @@ Vale
857857
[Vale](https://vale.sh/) is an open-source, command-line tool that helps maintain a consistent and on-brand voice in documentation.
858858
Plone Documentation uses it to check spelling, English grammar and syntax, and style guides.
859859
860+
schema enhancer
861+
A schema enhancer uses the `schemaEnhancer` function, which can modify the schema used by the `InlineForm` component.
862+
Any registered extension plugin can provide a `schemaEnhancer` function.
863+
This function receives an object with `formData`, which is the block data; `schema`, which is the original schema to modify; and the injected `intl`, which aids with internationalization.
864+
865+
variation
866+
A variation is a common development pattern that provides alternative views for the same data.
867+
For example, a teaser block can present data as `title + link`, `title + description + link`, or `title + image + link`.
868+
869+
An advanced variation can enhance the block by adding data fields to the block.
870+
For example, a listing block variation can show news items with `title + link`.
871+
Extending this example, a developer can add a boolean field to the block that toggles the display of the link.
872+
Thus an editor can select between `title + link` or just `title`.
873+
874+
HOC
875+
Higher-Order Component
876+
A higher-order component (HOC) is an advanced technique in React for reusing component logic.
877+
HOCs are not part of the React API, per se.
878+
They are a pattern that emerges from React's compositional nature.
879+
Concretely, a higher-order component is a function that takes a component and returns a new component.
880+
881+
```{important}
882+
Higher-order components are not commonly used in modern React code.
883+
```
884+
```{seealso}
885+
https://legacy.reactjs.org/docs/higher-order-components.html
886+
```
887+
860888
```

0 commit comments

Comments
 (0)