IShapeTableProvider in themes aren't used when building shape table

Topics: Troubleshooting, Writing modules, Writing themes
Developer
Mar 7, 2011 at 4:24 PM

Hi!

I wonder why the DefaultShapeTableManager filters out shapes provided by themes? What issues were behind such design decision?

I want to build a complex theme, which will provide a couple of new code-based shapes and alter the description of some existing ones (just like modules do). The altering would affect not only the display logic, but also the creation one. Unfortunately only the OnDisplaying event of ShapeAlteration gets called - OnCreating and OnCreated are simply ignored.

Is this a bug or if not - maybe there is some workaround? Maybe I could separate it into module and theme instead of a single complex theme? But afaik themes cannot be explicitely dependent on specified modules (although the manifest file allows to specify those), am I right?

Cheers, Piotr

Developer
Mar 7, 2011 at 4:40 PM
Edited Mar 7, 2011 at 4:42 PM

For clarification - I'd like to pre-fill the layout shape (in my theme) with some empty zones without waiting for WidgetFilter to create those.

Coordinator
Mar 8, 2011 at 2:00 AM

Not sure I understand. What is preventing you from adding empty zones to layout?

Developer
Mar 8, 2011 at 2:18 AM
Edited Mar 8, 2011 at 2:19 AM

Yes, you are right, that should do, but... I need to modify the existing "Zone" shape description first (to utilize some custom data), and this is only partly achievable from inside the theme. The OnCreating and OnCreated actions are not called, only the OnDisplaying/OnDisplayed does.

I tracked it down to DefaultShapeTableManager. At shape creation stage, the shape table is being filtered (because of null themeName argument in GetShapeTable), so the alterations coming from themes are rejected. At second stage where the displaying stuff takes place everything is ok - the shape table contains alterations from both modules and themes.

I found a workaround to put the shape altering stuff in separate module. And now I'm struggling with making the theme depend on module (so it would get enabled when the dependent theme gets enabled). For modules it's easy (just a line in manifest file), but for themes it doesn't work:/

- Piotr