This has been asked here before; but question is closed and the few replies do not provide sufficient information.
I am trying to use a contrib module (sitewide_alert) which provides its own custom entity. I am trying to figure out how to patch this module to make it fieldable (and how to do this in general).
In other posts I have seen suggestions to add the follinwg to the ContentEntityType annotation:
- fieldable = TRUE;
- bundle_entity_type = ??
- field_ui_base_route -> different suggestions but already exists for this module pointing to the module's config form.
But none of those seemed to fix this.
the full annotation for the entity is:
* @ContentEntityType( * id = "sitewide_alert", * label = @Translation("Sitewide Alert"), * label_plural = @Translation("Sitewide Alerts"), * label_collection = @Translation("Sitewide Alerts"), * handlers = { * "storage" = "Drupal\sitewide_alert\SitewideAlertStorage", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "list_builder" = "Drupal\sitewide_alert\SitewideAlertListBuilder", * "views_data" = "Drupal\sitewide_alert\Entity\SitewideAlertViewsData", * "translation" = "Drupal\sitewide_alert\SitewideAlertTranslationHandler", * * "form" = { * "default" = "Drupal\sitewide_alert\Form\SitewideAlertForm", * "add" = "Drupal\sitewide_alert\Form\SitewideAlertForm", * "edit" = "Drupal\sitewide_alert\Form\SitewideAlertForm", * "delete" = "Drupal\sitewide_alert\Form\SitewideAlertDeleteForm", * }, * "route_provider" = { * "html" = "Drupal\sitewide_alert\SitewideAlertHtmlRouteProvider", * }, * "access" = "Drupal\sitewide_alert\SitewideAlertAccessControlHandler", * }, * base_table = "sitewide_alert", * data_table = "sitewide_alert_field_data", * revision_table = "sitewide_alert_revision", * revision_data_table = "sitewide_alert_field_revision", * show_revision_ui = TRUE, * translatable = TRUE, * admin_permission = "administer sitewide alert entities", * entity_keys = { * "id" = "id", * "revision" = "vid", * "label" = "name", * "uuid" = "uuid", * "uid" = "user_id", * "langcode" = "langcode", * "published" = "status", * }, * revision_metadata_keys = { * "revision_user" = "revision_user", * "revision_created" = "revision_created", * "revision_log_message" = "revision_log", * }, * links = { * "canonical" = "/admin/content/sitewide_alert/{sitewide_alert}", * "add-form" = "/admin/content/sitewide_alert/add", * "edit-form" = "/admin/content/sitewide_alert/{sitewide_alert}/edit", * "delete-form" = "/admin/content/sitewide_alert/{sitewide_alert}/delete", * "version-history" = "/admin/content/sitewide_alert/{sitewide_alert}/revisions", * "revision" = "/admin/content/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/view", * "revision_revert" = "/admin/content/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/revert", * "revision_delete" = "/admin/content/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/delete", * "translation_revert" = "/admin/content/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/revert/{langcode}", * "collection" = "/admin/content/sitewide_alert", * }, * field_ui_base_route = "sitewide_alert.settings", * constraints = { * "ScheduledDateProvided" = {} * } * ) */ In my trial/error approach I did notice I created the Manage Fields/Display/etc UI for each entity I had previously created. So I think this is possibly related to not having a bundle defined? My use case doesn't require making new bundles (similar to the User entity).
Despite the other posted answers; my guess is modifying the annotation is not enough to add this functionality.