attus / entity_base
Drupal 实体基础模块
2.2.0
2024-06-21 08:12 UTC
Requires
- drupal/core: ^10.2 || ^11.0
README
Drupal 10 实体基础模块
申请自定义内容或配置实体类型
src\Entity\CustomContenEntity.php
* @ContentEntityType( * handlers = { * "storage" = "Drupal\entity_base\ContentEntityBaseStorage", * } * )
src\Entity\CustomConfigEntity.php
* @ConfigEntityType( * handlers = { * "storage" = "Drupal\entity_base\ConfigEntityBaseStorage", * } * )
通过 UUID 加载
$myContentEntity = \Drupal::entityTypeManager()->getStorage('custom_content_entity')->loadByUuid($uuid); $myConfigEntity = \Drupal::entityTypeManager()->getStorage('custom_config_entity')->loadByUuid($uuid);
您可以在没有任何限制的情况下自由使用此模块,但不提供任何保证。