How do I add a tab detached from an entity's domain?
To build a custom tab you will need to tap into the AdminBasicEntityController.modifyEntityForm(...) method.
In this method, you can add a new tab and even provide a custom html template which can then hold all the elements needed for your custom logic which can be set in a custom admin controller or in the extended product/customer admin controller. Here's an example of how we do this (from the OMS module):
protected void createOrderTab(EntityForm ef, Order order, Integer tabOrder, String tabKey, String component) { Field field = new Field(); field.setFieldComponentRenderer(component); field.setName(tabKey); field.getAttributes().put("order", order); FieldGroup group = new FieldGroup() .withKey(tabKey) .withCustomTemplate("components/oms_cardless_group"); group.setIsUntitled(true); group.addField(field); Tab tab = new Tab().withKey(tabKey) .withTabClass(tabKey) .withTabClass(" oms-tab oms-order") .withOrder(tabOrder); tab.getFieldGroups().add(group); ef.getTabs().add(tab); }
Note that depending on the entity you are working with, you may need to override a more specific admin controller such as the AdminProductController or AdminOmsCustomerController