0

I have an entity that has no bundles(ie. it has itself as a - 1 - bundle) and I need to be able to use View modes for it.

My understnading is that the Field UI needs the 'bundle of' entity to exist in order to attach itself to it.

Is somehow possible to get around this?

Should I file an issue on d.org?

3

tl;dr: If your entity annotation contains an admin form, field UI will work.

This is what they would mark on Quora as 'Questions That Contain Assumptions' and those questions usually contain false assumptions. In this case 'bundle of' doesn't even appear in the field UI directory anywhere. Instead, here's how I'd found the answer to your question -- it's not hard at all. First look in core/modules/field_ui/field_ui.routing.yml. Nothing. Well, it's dynamic, if it's dynamic then it's going to be in core/modules/field_ui/lib/Drupal/field_ui/Routing/ and it is. Let's look in RouteSubscriber.php in that directory:

foreach ($this->manager->getDefinitions() as $entity_type_id => $entity_type) {
  $defaults = array();
  if ($entity_type->isFieldable() && $entity_type->hasLinkTemplate('admin-form')) {

Now a quick counter check on the Node annotation and see, under links, there's "admin-form" = "node.type_edit" so that's that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy