You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code widget provides a code editor (powered by [Codemirror](https://codemirror.net)) with optional syntax awareness. Can output the raw code value or an object with the selected language and the raw code value.
7
9
8
-
-**Name:**`code`
9
-
-**UI:** code editor
10
-
-**Data type:** string
11
-
-**Options:**
12
-
-`default_language`: optional; default language to use
13
-
-`allow_language_selection`: optional; defaults to `false`: allows syntax to be changed
14
-
-`keys`: optional; sets key names for code and lang if outputting an object; defaults to `{ code: 'code', lang: 'lang' }`
15
-
-`output_code_only`: set to `true` to output the string value only, defaults to `false`
16
-
17
-
-**Example:**
18
-
```yaml
19
-
- label: 'Code'
20
-
name: 'code'
21
-
widget: 'code'
22
-
```
10
+
**Name:**`code`
11
+
12
+
**UI:** code editor
13
+
14
+
**Data type:** string
15
+
16
+
**Options:**
17
+
18
+
-`default_language`: optional; default language to use
19
+
-`allow_language_selection`: optional; defaults to `false`: allows syntax to be changed
20
+
-`keys`: optional; sets key names for code and lang if outputting an object; defaults to `{ code: 'code', lang: 'lang' }`
21
+
-`output_code_only`: set to `true` to output the string value only, defaults to `false`
The file widget allows editors to upload a file or select an existing one from the media library. The path to the file will be saved to the field as a string.
6
9
7
-
***Name:**`file`
8
-
***UI:** file picker button opens media gallery
9
-
***Data type:** file path string
10
-
***Options:**
11
-
12
-
*`default`: accepts a file path string; defaults to null
13
-
*`media_library`: media library settings to apply when a media library is opened by the
14
-
current widget
15
-
16
-
*`allow_multiple`: *(default: `true`)* when set to `false`, prevents multiple selection for any media library extension, but must be supported by the extension in use
17
-
*`config`: a configuration object that will be passed directly to the media library being
18
-
used - available options are determined by the library
19
-
*`media_folder` (Beta): file path where uploaded files will be saved specific to this control. Paths can be relative to a collection folder (e.g. `files` will add the file to a sub-folder in the collection folder) or absolute with reference to the base of the repo which needs to begin with `/` (e.g `/static/files` will save uploaded files to the `static` folder in a sub folder named `files`)
20
-
*`choose_url`: *(default: `true`)* when set to `false`, the "Insert from URL" button will be hidden
21
-
***Example:**
22
-
23
-
```yaml
24
-
- label: "Manual PDF"
25
-
name: "manual_pdf"
26
-
widget: "file"
27
-
default: "/uploads/general-manual.pdf"
28
-
media_library:
29
-
config:
30
-
multiple: true
31
-
```
10
+
**Name:**`file`
11
+
12
+
**UI:** file picker button opens media gallery
13
+
14
+
**Data type:** file path string
15
+
16
+
**Options:**
17
+
18
+
-`default`: accepts a file path string; defaults to null
19
+
-`media_library`: media library settings to apply when a media library is opened by the current widget
20
+
-`allow_multiple`: *(default: `true`)* when set to `false`, prevents multiple selection for any media library extension, but must be supported by the extension in use
21
+
-`config`: a configuration object that will be passed directly to the media library being used - available options are determined by the library
22
+
-`media_folder` (Beta): file path where uploaded files will be saved specific to this control. Paths can be relative to a collection folder (e.g. `files` will add the file to a sub-folder in the collection folder) or absolute with reference to the base of the repo which needs to begin with `/` (e.g `/static/files` will save uploaded files to the `static` folder in a sub folder named `files`)
23
+
-`choose_url`: *(default: `true`)* when set to `false`, the "Insert from URL" button will be hidden
24
+
25
+
**Example**
26
+
27
+
```yaml
28
+
- label: "Manual PDF"
29
+
name: "manual_pdf"
30
+
widget: "file"
31
+
default: "/uploads/general-manual.pdf"
32
+
media_library:
33
+
config:
34
+
multiple: true
35
+
```
32
36
33
37
### File Size Limit
34
38
@@ -41,3 +45,7 @@ You can set a limit to as what the maximum file size of a file is that users can
41
45
config:
42
46
max_file_size: 1024000# in bytes, only for default media library
Hidden widgets do not display in the UI. In folder collections that allow users to create new items, you will often want to set a default for hidden fields, so they will be set without requiring an input.
7
9
8
-
-**Name:**`hidden`
9
-
-**UI:** none
10
-
-**Data type:** any valid data type
11
-
-**Options:**
12
-
-`default`: accepts any valid data type; recommended for collections that allow adding new items
The image widget allows editors to upload an image or select an existing one from the media library. The path to the image file will be saved to the field as a string.
*`default`: accepts a file path string; defaults to null
13
-
*`media_library`: settings to apply when a media library is opened by the
14
-
current widget
15
-
*`allow_multiple`: *(default: `true`)* when set to `false`, multiple selection will be disabled even if the media library extension supports it
16
-
*`config`: a configuration object passed directly to the media library; check the documentation of your media library extension for available `config` options
17
-
*`media_folder` (Beta): file path where uploaded images will be saved specific to this control. Paths can be relative to a collection folder (e.g. `images` will add the image to a sub-folder in the collection folder) or absolute with reference to the base of the repo which needs to begin with `/` (e.g `/static/images` will save uploaded images to the `static` folder in a sub folder named `images`)
18
-
*`public_folder`*(defaults to the value of `media_folder`, with an opening `/` if one is not already included.)*: specifies the folder path where the files uploaded by the media library will be accessed, relative to the base of the built site. The value of the field is generated by prepending this path to the filename of the selected file.
19
-
*`choose_url`: *(default: `true`)* when set to `false`, the "Insert from URL" button will be hidden
-`default`: accepts a file path string; defaults to null
19
+
-`media_library`: settings to apply when a media library is opened by the current widget
20
+
-`allow_multiple`: *(default: `true`)* when set to `false`, multiple selection will be disabled even if the media library extension supports it
21
+
-`config`: a configuration object passed directly to the media library; check the documentation of your media library extension for available `config` options
22
+
-`media_folder` (Beta): file path where uploaded images will be saved specific to this control. Paths can be relative to a collection folder (e.g. `images` will add the image to a sub-folder in the collection folder) or absolute with reference to the base of the repo which needs to begin with `/` (e.g `/static/images` will save uploaded images to the `static` folder in a sub folder named `images`)
23
+
-`public_folder`*(defaults to the value of `media_folder`, with an opening `/` if one is not already included.)*: specifies the folder path where the files uploaded by the media library will be accessed, relative to the base of the built site. The value of the field is generated by prepending this path to the filename of the selected file.
24
+
-`choose_url`: *(default: `true`)* when set to `false`, the "Insert from URL" button will be hidden
25
+
26
+
**Example**
21
27
22
28
```yaml
23
-
- label: "Featured Image"
24
-
name: "thumbnail"
25
-
widget: "image"
26
-
choose_url: true
27
-
default: "/uploads/chocolate-dogecoin.jpg"
28
-
media_library:
29
-
config:
30
-
multiple: true
29
+
- label: "Featured Image"
30
+
name: "thumbnail"
31
+
widget: "image"
32
+
choose_url: true
33
+
default: "/uploads/chocolate-dogecoin.jpg"
34
+
media_library:
35
+
config:
36
+
multiple: true
31
37
```
32
38
33
39
### Image Size Limit
@@ -41,3 +47,7 @@ You can set a limit to as what the maximum file size of a file is that users can
41
47
config:
42
48
max_file_size: 512000# in bytes, only for default media library
0 commit comments