Blocks

Last updated: September 2026, plugin 1.5.2

Three dynamic blocks bring collections, records and forms into the block editor. Each wraps one shortcode: the editor turns the block attributes into the shortcode string, so blocks and shortcodes share one code path, the same templates and the same theme overrides.

The three blocks

All three live in the Widgets category under the wbsdvc/ namespace. Search for "Dataverse" in the block inserter.

BlockNameRenders
Dataverse Collectionwbsdvc/collectionThe card grid of a collection, with the detail view on the same page
Dataverse Recordwbsdvc/recordThe detail view of one record, picked by slug or read from the page URL
Dataverse Formwbsdvc/formA form whose submissions create or update records

The sidebar offers a dropdown of the collections and forms configured on the settings page, labelled key (table) or key (entity set). When nothing is configured yet, the block shows a link to the right settings tab instead. Blocks do not support custom HTML editing or extra class names; styling goes through templates and the theme.

Attributes

BlockAttributeShortcode equivalent
Collectionnamename, the collection key
per_page (0 = collection setting)per_page
columns (1 to 4)columns
detail_pagedetail_page
formform
search (default, on, off)search="1" or "0"
filters (default, on, off)filters="1" or "0"
sort (default, on, off)sort="1" or "0"
Recordnamename
slug (empty reads ?dvc=)slug
formform
Formnamename, the form key
record (slug or id to bind to)record

"Default" leaves the collection's own setting alone; "on" and "off" force the control. The three-state switches map to the 1/0 shortcode values, so the block cannot do anything the shortcode cannot. A block without a selection renders nothing on the front end.

<!-- what the Collection block renders -->
      [wbsdvc_collection name="listings" per_page="12" columns="3" search="1"]

Preview

The editor shows a server-rendered preview through the core block-renderer REST route, which requires the edit_posts capability. The preview is the real output: the same templates, the same data, the same cache. A collection with a slow environment renders slowly in the editor too; set a cache lifetime on the collection if that bothers editors. An unconfigured connection shows the same notice in the editor that visitors would see.

Theme styling

The plugin's front-end stylesheet is loaded inside the editor as well, so the preview looks like the published page. Front-end markup uses dvc- classes (dvc-collection, dvc-toolbar, dvc-grid, dvc-card, dvc-pagination, dvc-detail, dvc-form). Override the look in one of three ways:

  • Style the dvc- classes in your theme's stylesheet.
  • Copy a template from wbs-connect-for-dataverse/templates/ to your-theme/wbs-connect-for-dataverse/ and change the markup. Blocks pick up the override immediately.
  • Adjust the dropdown labels or add entries for the editor with the wbs_dataverse_connect_blocks_data filter.

The block scripts are plain ES5 with no build step, and the block metadata lives in blocks/collection, blocks/record and blocks/form.

Elementor and other builders

Page builders without block support use the shortcode: in Elementor, drop a Shortcode widget and paste [wbsdvc_collection name="listings"]. Output and templates are identical to the block.

See also