Created
January 11, 2024 14:38
-
-
Save twfahey1/47bd861e4fd72652401377f5f59cfdbb to your computer and use it in GitHub Desktop.
Install a new custom entity in Drupal 10 existing module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Scenario: We just added a new content entity via drush generate entity:content. We want to install it. | |
* The module was already enabled, so we can easily install it with 2 lines. | |
*/ | |
function superentity_demo_update_8001() | |
{ | |
$entity_type_manager = \Drupal::entityTypeManager(); | |
\Drupal::entityDefinitionUpdateManager()->installEntityType($entity_type_manager->getDefinition('id_of_my_entity')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment