First of all, I'm sorry for my question because I'm beginner in Sitecore SXA and in English too. ;)
I'm working on SXA compatible component and I have already advanced well I think but I must have missed a few elements for my module to be complete and be 100% compatible with SXA.
So, I don't know really if my method is the best for a custom component? And if I forgot to do something?
Here I proceeded to realize my module, and it's just a component to make a list of tree buttons:
I made a model that implements
RenderingModelBase
.I made a controller which implements
StandardController
with a method that retrieves the current datasource and then creates a model based on this datasource:
- And a view for my index ActionResult :
And after publishing on my website root, I make a template for my component in the Content Editor.
I added the base template for my rendering parameter,
IStyling
andIComponentVariant
.I add a rendering using this template rendering parameter and use my controller name and ActionResult name.
Next, I add this rendering in my toolbox, by adding an available rendering in my presentation folder and add this rendering inside.
And now, I can add this component in the Experience Editor, so it's great but I'm not sure if it's really good...
because :
- I don't see my CSS, my tree button it's just tree links...
- I don't use
@Model.CssClasses.Aggregate()
on my view because I can't ( I have an error if I use it ) but I see it on the other question in this site. So how can I use it and why? - I don't use the parameters
_repository
in my controller, and I do not know what it really is, but I see it on the other question on this site. So the same question how can I use it and why? - And finally, I'm not sure about putting these different items in the right place in my website file? Can someone show me what is the best practice?
I know that my questions may seem simple for some, but I confess that I am a little lost and I have not managed to find any answers.
In any case, thank you for having already read my post and even more if you answer it!