Overview
Formats
This module doesn't define any new formats.
Widgets
This module doesn't define any new widgets.
Fields
entity_browser
This module provides an entity_browser
field that integrates an entity browser iframe into an RJSF form. To use this field in the uiSchema set the field entity_browser
and add the entity_type
$filter to your field's schema definition. For more information on the available configuration options read the definitions below.
ui:options
browser
The machine id of the entity browser to use when selecting media. The entity browser must be configured to use "RJSF Modal" as the display plugin for everything to work correctly.
"uiSchema":{
"example":{
"ui:field":"entity_browser",
"ui:options":{
"browser":"rjsf_media_image_browser"
}
}
}
preview
The style in which to render the summary or preview of the selected entities. The two available options are grid
or list
. Default display is list.
"uiSchema":{
"example":{
"ui:field":"entity_browser",
"ui:options":{
"preview":"grid"
}
}
}
thumbnailStyle
The machine name of an image style to use when referencing media entities with a grid preview. Any defined image style can be used, defaults to thumbnail
.
"uiSchema":{
"example":{
"ui:field":"entity_browser",
"ui:options":{
"thumbnailStyle":"small_preview"
}
}
}
dialogTitle
The title for the dialog that pops up when a entity is selected.
"uiSchema":{
"example":{
"ui:field":"entity_browser",
"ui:options":{
"dialogTitle": "An example title"
}
}
}
selectButton
The title for the button on the form to select or change the selected entities.
"uiSchema":{
"example":{
"ui:field":"entity_browser",
"ui:options":{
"selectButton": {
"add": "Add an image",
"change": "Choose a different image"
}
}
}
}
Filters
This module doesn't define any new filters.
Examples
Single entity reference
{
"schema":{
"title":"Example single value media field",
"type":"object",
"properties":{
"example":{
"type":"array",
"format":"entity_reference",
"items":{
"type":"object"
},
"title":"Example title",
"description":"Select media to display",
"$filters":{
"$func":"entity_type",
"$vars":{
"target_type":"media"
}
}
}
}
},
"uiSchema":{
"example":{
"ui:field":"entity_browser",
"ui:options":{
"browser":"rjsf_media_image_browser"
}
}
}
}
Required entity reference
{
"schema":{
"title":"Example required media field",
"type":"object",
"properties":{
"example":{
"type":"array",
"minItems":1,
"format":"entity_reference",
"items":{
"type":"object"
},
"title":"Example title",
"description":"Select media to display",
"$filters":{
"$func":"entity_type",
"$vars":{
"target_type":"media"
}
}
}
}
},
"uiSchema":{
"example":{
"ui:field":"entity_browser",
"ui:options":{
"browser":"rjsf_media_image_browser"
}
}
}
}
Multiple media reference
{
"schema":{
"title":"Example multiple value media field",
"type":"object",
"properties":{
"multiple":{
"type":"array",
"format":"entity_reference",
"maxItems":5,
"items":{
"type":"object"
},
"title":"Multiple media reference",
"description":"Select media to display",
"$filters":{
"$func":"entity_type",
"$vars":{
"target_type":"media",
"bundles":[
"image"
]
}
}
}
}
},
"uiSchema":{
"multiple":{
"ui:field":"entity_browser",
"ui:options":{
"browser":"rjsf_media_image_browser",
"thumbnailStyle":"medium",
"preview":"grid"
}
}
}
}