This module allows you to create entities that cannot be deleted or created through the Drupal user interface, even by administrators. These entities can only be managed by code, providing a way to protect critical content from accidental removal while still allowing for editing and translation. This is ideal for content that rarely changes, such as system settings or predefined lists.
This module provides a new type of entities that cannot be created or deleted using the Drupal UI. This is valid also for site administrators with full privileges.
Permanent entities can only be created and deleted by code (using hook_update_N or via drush commands). Edit permissions are available per bundle.
Use cases
The main use case of this module is to have regular entities that you don't want to be deleted by error by a content administrator. Also this usually applies for a set of content that rarely varies over time. Like the planets of the solar system, the districts of a city, weather season, etc.
Users will still be able to edit and translate this entities. But they won't be able to delete them, or create new ones using an user interface.
Mode of use
Before create a permanent entity, you will need to create a Permanent Entity Type. This can be done via admin/structure/permanent_entity_types Then you can create instances either using drush:
drush pec planet jupiter Jupiter
Or using PHP code:
use Drupal\permanent_entities\Entity\PermanentEntity;
PermanentEntity::create([
'id' => 'jupiter',
'label' => 'Jupiter',
'type' => 'planet',
])->save();
Finally all permanent entities can be edited or translated via /admin/content/permanent_entities
Do you want to know more?
Checkout the documentation.
Ask your assistant about Permanent Entities
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.0.0-beta7 | Pre-release | 10–11 | Nov 4, 2024 | ||
| 2.0.0-beta6 | Pre-release | 9–11 | Nov 1, 2024 | ||
| 8.x-1.0-beta5 | Pre-release | 8–9 | PHP >=7.0.0 | Feb 8, 2023 | |
| 8.x-1.0-beta4 | Pre-release | 8–9 | PHP >=7.0.0 | Jan 31, 2023 |