Documentation about shapes..

Topics: General
Mar 2, 2011 at 12:22 PM

There is some blogging about shapes, but i'm looking for more.
Is there somewhere an architectual conceptual documentation available about the shape core framework? I couldn't find it on: 'the wiki', 'on a blog', in 'a discussion'
I Believe it isn't Clay either.

I mean:

The ShapteTableBuilder, describing a ShapeAlteration
The ShapeTableManager for ShapeTables
The DefaultContentDisplay binding placement to the context so that placement can be located for a shape

I got the feeling i'm diving too deep into the core, i just want to know the basic technical global concepts so i get more understanding about how to create own alterations / descriptors.

I wonder who of the team wrote this "core" functionality :)

Mar 2, 2011 at 12:46 PM

Maybe it's enough just to know how to impliment the IShapeTableProvider interface, which i think i start to understand.

    public class Shapes : IShapeTableProvider {
        public void Discover(ShapeTableBuilder builder) {
            builder.Describe("MyShape")
                .Configure(descriptor => {
                    // do configuration
                })
                .OnCreated(created => {
                    // do aditional dynamic things 
                })
                .OnDisplaying(displaying => {
                    // do things with shape and shapemetadata
                })
                .Placement(placement => {
                    // return placement
                    return null;
                });
        }
    }

Coordinator
Mar 2, 2011 at 5:54 PM

There is no deep documentation on that, which doesn't mean you shouldn't look :)

You are correct that IShapeTableProvider is one of the most useful extensibility points in the system.

Mar 3, 2011 at 9:40 AM

ahhhh

[RuntimeBinderException: 'ClaySharp.Clay' does not contain a definition for 'Add']
   lambda_method(Closure ) +57
   ClaySharp.ClayBehavior.InvokeMemberMissing(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +36
   ClaySharp.<>c__DisplayClass2e.<InvokeMemberMissing>b__2b() +79
   ClaySharp.ClayBehavior.InvokeMemberMissing(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +36
   ClaySharp.<>c__DisplayClass2e.<InvokeMemberMissing>b__2b() +79
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +58
   ClaySharp.ClayBehaviorCollection.InvokeMemberMissing(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +144
   lambda_method(Closure ) +644
   ClaySharp.Behaviors.NilBehavior.InvokeMember(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +58
   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +79
   ClaySharp.ClayBehavior.InvokeMember(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +36
   ClaySharp.<>c__DisplayClass10.<InvokeMember>b__d() +79
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +58
   ClaySharp.ClayBehaviorCollection.InvokeMember(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +144
   CallSite.Target(Closure , CallSite , Object , Object , String ) +853
   Orchard.ContentManagement.Drivers.ContentShapeResult.ApplyImplementation(BuildShapeContext context, String displayType) +3196
   Orchard.ContentManagement.Drivers.ContentShapeResult.Apply(BuildEditorContext context) +52
   Orchard.ContentManagement.Drivers.CombinedResult.Apply(BuildEditorContext context) +125
   Stp.Fields.Shapes.Field(Object Display, Object Shape, ContentPart part, DateTimeField field) +885

Mar 3, 2011 at 9:59 AM

Nice that any method with the [Shape] attribute can automaticly have the parameters Shape, Display, Output and Html injected by the ShapeAttributeBindingStrategy.

But strange enough, the injected parameter Shape cannot be used as parentShape somehow, i've no idea why, i keep getting above exception.
It's assigned while debugging..
I wrote my own FindPlacement which is always returning "Content"

When the implementation is being applied the exception is thrown.

parentShape.Zones["Content"].Add(newShape)

Mar 3, 2011 at 12:37 PM

The injected Shape seems to be my own thing:

@Display.RenderMyField(part: Model.Part, field : Model.MyField)

then it has

1 interceptor
3 behaviors (InterfaceProxyBehavior, PropBehavior, NilResultBehavior)

0 Attributes
0 Classes
MetaData Type = RenderMyField

Calling Apply on the ContentShapeResult want the parentShape to have Zones.
I saw a part can have Zones

        //interesting thought, should/could parts also have zones (would then have zones on the page, content item and parts...)?
        private readonly IZoneCollection _zones = new ZoneCollection();
        public virtual IZoneCollection Zones {
            get {
                return _zones;
            }
        }

Mar 7, 2011 at 11:15 AM

Ok, it's kinda easy if u know more about behaviours. I needed to add a ZoneHoldingBehaviour to my own Shape.