- Home
- Extend
- Architecture and APIs
- Submodule architecture
Submodules
The modules/ directory holds three submodules. Two are small
configuration packages: a content type and a block type wired to the
builder. The third is the legacy Entity Browser media picker that
predates Media Library support. This page documents
what each one installs, what it depends on, and how to enable or
retire it.
| Module | Machine name | Provides | Status |
|---|---|---|---|
| DXPR Builder Drag and Drop Page | dxpr_builder_page |
drag_and_drop_page content type |
Supported |
| DXPR Builder Block Type | dxpr_builder_block |
drag_and_drop_block block type |
Supported |
| DXPR Builder Media | dxpr_builder_media |
Entity Browser media picker | Legacy; hidden from the Extend page |
None of them is required. The builder works on any text field whose
view display uses the DXPR Builder formatter
(dxpr_builder_text); see
Installing on existing content types.
DXPR Builder Drag and Drop Page
modules/dxpr_builder_page installs the Drag and Drop Page
content type (node.type.drag_and_drop_page) from
config/optional/:
- The
bodyfield, with the default view display using thedxpr_builder_textformatter and the form display grouped with Field Group. - Three DXPR Theme fields:
field_dth_hide_regions,field_dth_main_content_widthandfield_dth_page_layout. They install only when their field storages exist, which the DXPR Theme Helper module provides.
Dependencies from dxpr_builder_page.info.yml: field_group,
text, node and dxpr_builder. hook_install() creates the
body field storage when it does not exist. When the optional
config cannot install, as on the Minimal profile, it installs the
type, body field and displays itself, without the menu_ui and
path parts. dxpr_builder_page_update_8001() marks the installed
config as enforced by the module.
src/DXPRBuilderPageUninstallValidator.php (registered in
dxpr_builder_page.services.yml) blocks uninstalling while any
drag_and_drop_page node exists. Delete or change the type of those
nodes first.
- Enable the module:
bash
drush en dxpr_builder_page -y
- Create a page at
/node/add/drag_and_drop_page. The builder starts on the body field when the page is viewed by an editor.
If enabling fails with "unmet dependencies", enable Field Group and
check that a body field storage exists; see
Problems after updating.
DXPR Builder Block Type
modules/dxpr_builder_block installs the Drag and Drop Block
block type (block_content.type.drag_and_drop_block) from
config/optional/, with a body field, the dxpr_builder_text
formatter on the default view display, and the form display. The
type has Create new revision turned on, and
dxpr_builder_block_update_8002() turns it on for older installs,
so every builder save on a block creates a revision (see
Content staging).
Dependencies: text, node and dxpr_builder.
- Enable the module:
bash
drush en dxpr_builder_block -y
- Create a block at
/block/add/drag_and_drop_block. - Place it in a region. Editors edit it in place on any page where it appears.
dxpr_builder_entity_type_alter() swaps in the module's own
Drupal\dxpr_builder\Entity\BlockContent class, as it does for
Node. The class saves an empty string into empty builder fields,
so the editor always has something to attach to. A block type you
create yourself therefore works the same way once its view display
uses the DXPR Builder formatter.
DXPR Builder Media
modules/dxpr_builder_media is the Entity Browser based image
picker that the module used before core Media Library support. It
is marked hidden: true in its .info.yml, so it does not appear
at Extend; you can still enable it with Drush. It installs:
entity_browser.browser.dxpr_builder_media_modal: a modal browser labelled DXPR Builder Image Browser with two widgets, a Media Library tab backed by thedxpr_builder_mediaView and an Upload new image tab that creates animagemedia entity through Inline Entity Form.views.view.dxpr_builder_media: the media grid for the first widget.image.style.dxpr_builder_media_thumbnail: a 300 by 300 pixel scale-and-crop style for the grid.- Libraries
view,claro_styleandgin_style(dxpr_builder_media.libraries.yml). The module attaches the Gin stylesheet to the View when the active theme is Gin or based on it, and the Claro stylesheet otherwise.
Dependencies: inline_entity_form, entity_browser,
entity_browser_entity_form, media, media_library and views.
On install the module sets media_browser in
dxpr_builder.settings to dxpr_builder_media_modal; on uninstall
it sets it to an empty string (Basic file upload) and deletes
the image style.
The recommended browser is core Media Library, which needs no submodule:
- Uninstall the legacy module if it is enabled:
bash
drush pm:uninstall dxpr_builder_media -y
- Go to DXPR Studio > DXPR Builder > General Settings
(
/admin/dxpr_studio/dxpr_builder/settings) and open Media. - Set Browser type to Media Library and click Save settings. The uninstall has reset it to Basic file upload.
Keep the submodule only on a site that depends on an Entity Browser
that returns file IDs; see
Images do not upload or disappear
for the errors a mismatched browser produces. The module carries
the repository's only PHPUnit test,
tests/src/FunctionalJavascript/MediaEntityBrowserTest.php; see
Testing.
Enabling several at once
drush en dxpr_builder_page dxpr_builder_block -y
Each submodule is independent of the others.
What's next?
- Content types for using the builder on your own content types.
- Media Library integration for the recommended image picker.