XF 2.0 XF2: Getting the url for an entity

Xon

Well-known member
Most entities have some sort of URL representation, and from what I've seen there are at least 4 different ways to get a URL to an entity in a generic-ish way;
  • Report Handler
  • Warning Handler
  • Edit History Handler
  • Attachment Handler
Is there a better or more sane solution?
 
None of those approaches are particularly dissimilar. Is there anything particularly “insane” about those methods in those handlers? Are you trying to achieve something specific?
 
It is more the observation that every one of these handlers does the same thing when fetching the url/link; map a entity to a route. Everything else is just dressing on what is sent to buildLink. There are other handlers (Likes and Alerts for example), which don't have these mappings which are limitations if you want to extend those particular handlers for additional functionality.

I'm glad that entities are now aware of their content type/id, but them being aware of a default route would also be very useful.

I can put together some situations later (need to run now) but I've run into the limitations of going from content to url in before in XF1, and just encountered it in a different solution in an add-on I'm writing for XF2.
 
Top Bottom