Modules such as RestWS and RDFx rely on the entity API to answer REST calls such as node/1.xml and return data associated with node/1 in XML. This works well for comments and user, but fails for taxonomy terms. Users cannot add .xml to taxonomy/term/1, they need to go to taxonomy_term/1.xml, which is a usability issue and inconsistent with the way nodes and users work.
My understanding is that entity API doesn't necessarily follow the path core uses when defining entity types in the entity info array:
$entity_info['node'] #same as node/1
$entity_info['taxonomy_term'] # does not match taxonomy/term/1
Which direction do you suggest to fix this? Could entity API define a new key for the path to the entities perhaps?
$entity_info['taxonomy_term']['plural label'] = t('Taxonomy terms');
$entity_info['taxonomy_term']['description'] = t('Taxonomy terms are used for classifying content.');
$entity_info['taxonomy_term']['path'] = 'taxonomy/term';
so that module defining their own entity type can also say which path to use to access its entities? for example
$entity_info['my_fancy_entity_type']['path'] = 'fancy-type';
would let people to view an entity at fancy-type/1 instead of the default my_fancy_entity_type/1.
Comments
Comment #1
wikier commentedThis issue causes inconsistency on the entities linking in RDF, see http://drupal.org/node/1846646 for further details.
Comment #2
fagoAlso see the related issue I created once for restws: #1820864: Make taxonomy terms play with uuid_redirect
I'm wondering whether this is something we just fix in restws or whether there are more modules needing it. I'm hesitant to introduce yet another key just because of restws as restws already has its own key for that.