This project is not covered by Drupal’s security advisory policy.
This project allows you to embed a box entity which it provides into another entity using a text filter. Imagine you have a block-like content, which you would like to have embedded in content area of your site. You can just write:
[box:entity_id] or [box:entity_id:view_mode]
and this module will do all the magic, displaying box entity specified by entity ID in a given view mode (defaults to full) in a themeable box and current website language. If you prefer using machine names which (unlike entity IDs) describe box content better, just write:
[box-name:entity_machine_name] or [box-name:entity_machine_name:view_mode]
Box entity has been created for the sole purpose of embedment. It has bundles enabled and one default bundle (Default) created, has no view URL, is revisionable, comes with a node-like per-bundle permissions and carries no extra functionality like nodes (URL aliases, authoring information, ...) or blocks (placement, visibility settings, ...) which are of no use for the purpose of embedding. If user does not have appropriate permission for viewing embedded boxes (View published Box entities / View unpublished Box entities), nothing is displayed. View published Box entities is automatically enabled for both anonymous and authenticated users when module is installed.
Installation and usage:
- Install Box module
- Enable Insert boxes text filter for desired text formats
- (optional) Create new box bundles at Administration -> Structure -> Box types
- Create box entities at Administration -> Content -> Boxes
- (optional) Override box template to your liking
- Embed boxes using text filter:
by entity ID: [box:entity_id] or [box:entity_id:view_mode]
by entity machine name: [box-name:entity_machine_name] or [box-name:entity_machine_name:view_mode]
Why would you need a new module if blocks with their wonderful new custom block types seem to be ideally poised to accomplish this task?
You can indeed use Insert Block module and it may work just fine. However using blocks has three major drawbacks which might or might not affect you depending on your use case. For me they merited introduction of a separate module:
- If you wish to use custom blocks with Insert Block module, it is possible with #2844631: Use Custom Blocks (Block Content), but discouraged in #2704331-19: Ability to display block_content entities independently, also outside of Blocks, since custom blocks are not intended to be rendered on their own in Drupal 8 and this functionality has been postponed as feature request for Drupal 9. So approach used in #2844631: Use Custom Blocks (Block Content) cannot be guaranteed to work seamlessly with future Drupal 8.x releases.
- If you stick with standard blocks, they need to be placed in some region before you get block's delta and are able to embed it. If you want to just embed the block, this adds unnecessary step to the process and you end up with a block being placed in a region but never displayed, which harms admin UX. As the number of blocks grows, you might end up with block overview page, which is very crowded and difficult to navigate.
- Blocks still come with a limited set of permissions, though that should improve soon. See #1975064: Add more granular block content permissions
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: Content editing experience
3 sites report using this module
- Created by bobooon on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
