Tips on how to make a customized entity fieldable?

This has been requested right here earlier than; however query is closed and Drupal Development few replies don’t present enough data.

I’m attempting ot utilizing a contrib module (sitewide_alert) which offers it is personal customized entity. I’m attempting to determine how one can patch this module to make it fieldable (and the way to do that generally).

In different posts I’ve seen options so as to add Drupal Development follinwg to Drupal Development ContentEntityType annotation:

  • fieldable = TRUE;
  • bundle_entity_type = ??
  • field_ui_base_route -> totally different options however already exists for this module pointing to Drupal Development module’s config type.

However none of these appeared to repair this.

Drupal Development full annotation for Drupal Development entity is:

* @ContentEntityType(  *   id = "sitewide_alert",  *   label = @Translation("Sitewide Alert"),  *   label_plural = @Translation("Sitewide Alerts"),  *   label_collection = @Translation("Sitewide Alerts"),  *   handlers = {  *     "storage" = "Drupalsitewide_alertSitewideAlertStorage",  *     "view_builder" = "DrupalCoreEntityEntityViewBuilder",  *     "list_builder" = "Drupalsitewide_alertSitewideAlertListBuilder",  *     "views_data" = "Drupalsitewide_alertEntitySitewideAlertViewsData",  *     "translation" = "Drupalsitewide_alertSitewideAlertTranslationHandler",  *  *     "type" = {  *       "default" = "Drupalsitewide_alertFormSitewideAlertForm",  *       "add" = "Drupalsitewide_alertFormSitewideAlertForm",  *       "edit" = "Drupalsitewide_alertFormSitewideAlertForm",  *       "delete" = "Drupalsitewide_alertFormSitewideAlertDeleteForm",  *     },  *     "route_provider" = {  *       "html" = "Drupalsitewide_alertSitewideAlertHtmlRouteProvider",  *     },  *     "entry" = "Drupalsitewide_alertSitewideAlertAccessControlHandler",  *   },  *   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" = "title",  *     "uuid" = "uuid",  *     "uid" = "user_id",  *     "langcode" = "langcode",  *     "printed" = "standing",  *   },  *   revision_metadata_keys = {  *     "revision_user" = "revision_user",  *     "revision_created" = "revision_created",  *     "revision_log_message" = "revision_log",  *   },  *   hyperlinks = {  *     "canonical" = "/admin/content material/sitewide_alert/{sitewide_alert}",  *     "add-form" = "/admin/content material/sitewide_alert/add",  *     "edit-form" = "/admin/content material/sitewide_alert/{sitewide_alert}/edit",  *     "delete-form" = "/admin/content material/sitewide_alert/{sitewide_alert}/delete",  *     "version-history" = "/admin/content material/sitewide_alert/{sitewide_alert}/revisions",  *     "revision" = "/admin/content material/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/view",  *     "revision_revert" = "/admin/content material/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/revert",  *     "revision_delete" = "/admin/content material/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/delete",  *     "translation_revert" = "/admin/content material/sitewide_alert/{sitewide_alert}/revisions/{sitewide_alert_revision}/revert/{langcode}",  *     "assortment" = "/admin/content material/sitewide_alert",  *   },  *   field_ui_base_route = "sitewide_alert.settings",  *   constraints = {  *     "ScheduledDateProvided" = {}  *   }  * )  */ 

In my trial/error method I did discover I created Drupal Development Handle Fields/Show/and so forth UI for every entity I had beforehand created. So I believe that is presumably associated to not having a bundle outlined? My use case would not require making new bundles (much like Drupal Development Consumer entity).

Regardless of Drupal Development different posted solutions; my guess is modifying Drupal Development annotation shouldn’t be sufficient so as to add this performance.

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Tips on how to make a customized entity fieldable?

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.