Enhancement to Layout Elements

Topics: Customizing Orchard, Writing modules
May 22, 2015 at 2:21 AM
I have been working with Layout Elements and one enhancement I think would be useful is for every Element to have a unique id with is assigned by the Layout Module upon creation of the element. The unique Id could be a Guid or an auto-incrementing integer preserved by the Layout. Example ( When the Layout is first created the counter is set to 1, all Element upon creation calls a routine like Layout.GetNextId which returns an integer and increment the internal counter. ) Also, I think Elements should have a standard way to know what Content Id they belong to.

With these two piece in place it would make it easy for an outside process to access particular element or elements. Right now I am experimenting with it in a derived class but I think this functionality really should be in the base Element class.

What do you think?