Process of adding custom buttons to the image editor

Topics: Customizing Orchard
May 10, 2014 at 12:17 PM
Edited May 10, 2014 at 12:18 PM
I am trying to make some customization to the image editor.
I added a Driver and the Parts Views just like for the resize option and I see as a result a new button for the shape I added in the driver. But I would really like to know how this process works.
After the statement

var shape = Services.ContentManager.BuildDisplay(contentItem);

In the controller there are buttons added to the shape.
My question is how does orchard decide to make a new button for the shape in my driver ?
And does the fact that the driver is a contenpartdriver<ImageEditorPar> cause orchard to also call the display method on the driver when calling the builddisplay method ?
May 13, 2014 at 12:45 PM
I discovered how the option is added to the buttons shape. Because I added Buttons as place for the part in the file. It seems that is the place where the buttons are defined. Turns out a shape is created a place you define there. The shape for my new part was added to the Buttons Shape of the model. In the view it is then rendered together with the other buttons in the view with the @Display(Model.Buttons) method. It is all very flexible with the shapetables, but I guess it takes a while to really understand the approach that Orchard uses with the shapes and template and placement files.