Navigation - Shape Link

Topics: General
Dec 12, 2014 at 11:37 PM
I have been toying around with the shape link Navigation and for the most part, it is working.
However, I have a couple of questions.

I have a shape link menu item that is being rendered in code. Works out fine. However, the idea of creating html in the .cs doesn't exactly sit well with me as I'm sure it doesn't for others as well. it's nitpicky, but it is what it is.

As a result, I have created a razor view in my Theme named the same as my menu and it renders great. However, I need to be able to do some dependency injection and add some additional property values to the Model so I can use them in this menu item razor view.
Is it possible to tie a driver or controller into this view to add onto the menu item model before the view renders?

As I said, I prefer this approach because I really don't want to be generating html in the .cs.
Developer
Dec 12, 2014 at 11:42 PM
You can further prepare your shape by implementing the IShapeTableProvder interface somewhere in your module. You can inject dependencies there. Be careful to inject dependencies using Work<T> if they are scoped by request.
Marked as answer by dxt_chris on 12/14/2014 at 3:56 PM
Dec 14, 2014 at 11:56 PM
Sipke,

Thanks for the response. it was exactly what I was looking for and working great. Turned out to be far simpler than it seemed at first.
I do have a follow up question...

First, I'm not completely certain what you mean by using Work<T> for the dependency injections. Can you please elaborate.

Also, (and this is a very open question), I've been developing for over 20 years and the answer to what I view to be a very simple issue
eluded me. I'd really like your opinion on how you believe me or really anyone else could have been able to figure this out on our own.
Or do you feel that this is the kind of not-so-straight-forward issue that is idea to post on this forum?

Thanks again for you help.