I am trying to create a custom entity with user manageable bundles with very little luck.
I have been using a couple of other modules that do this very successfully like field collection and the latest version of the invite module.
Very simply, there is an event entity which has multiple types. The user should be able to create and manage these multiple types - similar to how users can create and manage multiple field collections.
My entity info is as follows:
function enf_entity_info() { $return = array( 'enf_event' => array( 'label' => t('ENF Event'), 'entity class' => 'ENFEvent', // defined - simple 'controller class' => 'ENFEventController', // defined - simple 'base table' => 'enf_event', // defined 'fieldable' => TRUE, 'entity keys' => array( 'id' => 'event_id', 'bundle' => 'event_type', ), 'bundle keys' => array( 'bundle' => 'event_type', ), 'view modes' => array( // I don't expect to need these 'full' => array( 'label' => t('Default'), 'custom settings' => FALSE, ), ), 'bundles' => array(), 'label callback' => 'entity_class_label', 'uri callback' => 'entity_class_uri', 'module' => 'enf', 'access callback' => 'enf_event_access', // simply returns TRUE 'metadata controller class' => 'EntityDefaultMetadataController', ), ); $return['enf_event_type'] = array( 'label' => t('ENF Event Type'), 'entity class' => 'ENFEventType', // defined - simple 'controller class' => 'ENFEventTypeController', // defined - simple 'base table' => 'enf_event_type', // defined 'fieldable' => FALSE, 'bundle of' => 'enf_event', 'exportable' => TRUE, 'entity keys' => array( 'id' => 'type_id', 'name' => 'event_type', 'label' => 'label', ), 'module' => 'enf', // Enable the entity API's admin UI. 'admin ui' => array( 'path' => 'admin/structure/enf-event-types', 'file' => 'includes/enf.admin.inc', // includes the form functions //'controller class' => 'ENFEventTypeUIController', ), 'access callback' => 'enf_event_type_access', ); return $return; } the bundles are then added in in the alter
/** * Implements hook_entity_info_alter(). */ function enf_entity_info_alter(&$entity_info) { foreach (enf_get_types() as $type => $info) { $entity_info['enf_event']['bundles'][$type] = array( 'label' => $info->label, 'admin' => array( 'path' => 'admin/structure/enf-event-types/manage/%event_type', 'real path' => 'admin/structure/enf-event-types/manage/' . $type, 'bundle argument' => 5, ), ); } } The admin page seems to work - however, there are manage fields and manage display menu options on the page itself. These go to a
/admin/structure/enf-event-types/manage/%25event_type/fields and /admin/structure/enf-event-types/manage/%25event_type/display
and there are notifications displayed and saving and such errors out.
It is possible to add types - the form is displayed and creates a new type on submit.
However, when clicking through the fields or display links, a 404 comes back
/admin/structure/enf-event-types/manage/test/fields /admin/structure/enf-event-types/manage/test/display It seems like it should really be very simple to do this but something is missing.
Any assistance greatly appreciated...