wieni / wmcontent
Adds configurable entity containers to entity types (for e.g. paragraphs)
Installs: 16 740
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 6
Forks: 1
Open Issues: 6
Type:drupal-module
Requires
- php: ^8.1
- drupal/core: ^10.1
Requires (Dev)
- drupal/core-dev: ^10.1
- ergebnis/composer-normalize: ^2.0
- wieni/wmcodestyle: ^1.7
- dev-main
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.0.x-dev
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.6.1
- 0.6.0
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.25
- 0.4.24
- 0.4.23
- 0.4.22
- 0.4.21
- 0.4.20
- 0.4.19
- 0.4.18
- 0.4.17
- 0.4.16
- 0.4.15
- 0.4.14
- 0.4.13
- 0.4.12
- 0.4.11
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
This package is auto-updated.
Last update: 2024-11-27 16:09:42 UTC
README
Adds configurable entity containers to entity types (for e.g. paragraphs)
Why?
In Drupal 7 we noticed a couple of shortcomings with the Paragraphs module (that are still not solved in Drupal 8 AFAWK).
- Backend performance improvements: Paragraphs creates a widget within the default entity edit forms. This did not only clutter the interface when using > 10 paragraphs, the form itself would regularly become too large and break any decent PHP memory setting on submitting/saving. This module provides a separate tab for its content, instead of mixing it in with the node edit form through inline entity forms or similar solutions.
- Frontend performance improvements: The paragraphs of an entity are loaded separately from the standard entity data, which solves memory issues when displaying a lot of entities on a page.
- UI improvements: Features like cloning/duplication of paragraphs as well as drag and drop sorting of paragraphs become easier when not integrated in the default entity edit form.
- More flexibility: This module allows multiple lists of paragraphs (containers) to be attached to entities, where one can limit the available entity types and bundles on a per-container basis. This allows for e.g. a Content tab and a Program tab for activity/event content types.
Installation
This package requires PHP 8.1 and Drupal 10.0 or higher. It can be installed using Composer:
composer require wieni/wmcontent
How does it work?
Terminology
- A container connects hosts of a certain type to children of a certain type.
- A host is an entity with containers, e.g. a node with a paragraph container. A host can have multiple children per container.
- A child is an entity attached to a host through a container, e.g. a paragraph. Every entity can only be attached to a single container.
Children and hosts can be entities of any type with a canonical route,
implementing Drupal\Core\Entity\ContentEntityTypeInterface
.
When updating a child entity, the changed time of the host entity is updated as well.
Get started
Before you begin, make sure your user role has the administer wmcontent
permission. After that, you can get started by creating a new
container. You can do this by going to
/admin/config/wmcontent/containers
or by following the Structure >
WmContent > WmContent Containers menu link.
After creating the container, go to the (edit) page of a possible host entity. A new tab should have appeared with the name of the container you just created.
Clicking that link brings you to the master form, where you can add children to and edit/delete/reorder children from this host.
Displaying children
If you use Display Suite to build your pages, you can use the WmContent: Content blocks field to display the content of the children entities on a host.
You can change the way wmcontent containers are rendered by overriding
the wmcontent
theme implementation.
If you build your pages manually using Twig templates, you can load the
children of a host using WmContentManagerInterface::getContent
.
Changelog
All notable changes to this project will be documented in the CHANGELOG file.
Security
If you discover any security-related issues, please email security@wieni.be instead of using the issue tracker.
License
Distributed under the MIT License. See the LICENSE file for more information.