attus/entity_base

Drupal 实体基础模块

安装: 67

依赖: 0

建议者: 0

安全性: 0

星星: 0

关注者: 1

分支: 0

开放问题: 0

类型:drupal-module

2.2.0 2024-06-21 08:12 UTC

This package is auto-updated.

Last update: 2024-09-21 08:41:58 UTC


README

Drupal 10 实体基础模块

Maintenance GitHub license GitHub release GitHub issues

申请自定义内容或配置实体类型

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);

您可以在没有任何限制的情况下自由使用此模块,但不提供任何保证。