Question

I've built a couple of custom entities in Drupal 8

  • Vendor, defined as such:

    /**
     * Defines the vendor entity.
     * 
     * @EntityType(
     *   id = "vendor",
     *   label = @Translation("Vendor"),
     *   module = "vendor",
     *   controllers = {
     *     "storage" = "Drupal\vendor\VendorStorageController",
     *     "render" = "Drupal\Core\Entity\EntityRenderController",
     *     "form" = {
     *       "default" = "Drupal\vendor\VendorFormController",
     *       "delete" = "Drupal\vendor\Form\VendorDeleteForm"
     *     }
     *   },
     *   base_table = "vendor",
     *   uri_callback = "vendor_uri",
     *   translatable = FALSE,
     *   fieldable = TRUE,
     *   entity_keys = {
     *     "id" = "vendor_id",
     *     "uuid" = "uuid",
     *     "label" = "name",
     *     "bundle" = "type"
     *   },
     *   bundle_keys = {
     *     "type" = "type"
     *   },
     *   route_base_path = "admin/vendors/types/manage/{bundle}"
     * )
     */
    
  • and VendorType:

    /**
     * Defines the vendor type entity.
     * 
     * @EntityType(
     *   id = "vendor_type",
     *   label = @Translation("Vendor Type"),
     *   module = "vendor",
     *   controllers = {
     *     "storage" = "Drupal\vendor\VendorTypeStorageController",
     *     "access" = "Drupal\vendor\VendorTypeAccessController",
     *     "list" = "Drupal\Core\Config\Entity\ConfigEntityListController",
     *     "form" = {
     *       "default" = "Drupal\vendor\VendorTypeFormController",
     *       "delete" = "Drupal\vendor\Form\VendorTypeDeleteForm"
     *     }
     *   },
     *   config_prefix = "vendor.type",
     *   entity_keys = {
     *     "id" = "id",
     *     "uuid" = "uuid",
     *     "label" = "label"
     *   }
     * )
     */
    

VendorType is a config entity and serves as the bundle for Vendor, in exactly the same way that the core Node/NodeType entity types do. I have all the boilerplate code in place mimicking the Node/NodeType relationship.

Everything's up and running, the entities work great in every respect, but I can't figure out a small detail. On the "Content types" admin page, the action links in the right hand column of each row have the "Manage Fields/Manage Display/etc" links, plus the usual "Edit/Delete" as inherited from EntityFormController::actions().

enter image description here

On my VendorType overview form, I only see the Edit and Delete links, not the field-specific ones.

enter image description here

(ignore the missing delete buttons, those particular types can't be deleted; the delete link shows up for manually added types)

I've tried to track it down but it seems like the node module is getting these links added for "free" as it were, without implementing anything explicitly to add them.

What do I need to do to take advantage of this little nicety and get the field-specific links added automatically for my own entity types?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top