Dexterity contextual dynamic schema behavior

@avoinea fyi i ran into a transaction error in combination with cmfedition otherwise works fine. Didn't have time to look into it ... and kept me from doing a release :wink:

1 Like

Did you also ran into an empty object, like in https://jenkins.plone.org/view/PLIPs/job/plip-dx-siteroot-3.7/19/testReport/plone.app.contentrules.tests.test_action_versioning/TestVersioningAction/testExecute/ or Conflict error and "Could not adapt" error with Volto and Plone 5.2 ?

is it possible to add more fields than in the original content type schema, or is it just 'mapping to existing fields' ?

If more fields are possible, then Alin would not have to add a lot of content types (for example when 'Shoes' need fields 'size' and 'color'

1 Like

Yes. It looks like it saves the extra data on the newly created objects. But in order to edit it, you'll have to update DX Schema via Site Setup > Dexterity Content Types

Then it does no 'help much'

Well, I think I found what's wrong in the logic above. Instead of generating the schema on GET I should generate it on SET and store it somehow. Thus:

  • Create store (e.g.: Shoes)
  • Define faceted navigation criteria (e.g.: size, color)
  • Generate Schema and persist it. Register Data Mutator Adapter
  • On faceted navigation criteria update also update schema
  • On item add/edit get saved Schema from parent.

I think also collective.easyformplugin.createdx could do the same and be a Schema provider for generated DX objects.

So I do not get why its such a problem. To me its so obvious how to solve it (as stated above).

If you want to have some behavior on a type activated, one just need to make sure, some IBehaviorAssignable adapter kicks in and list the needed behavior for the type. No fiddling with forms and whatever needed. Behaviors are dynamic by design.

Since the context of the addform is the parent, the adapter needs to be provided for the parent type and the child type. In the adapter implementation you may need to figure out if you're in an add or edit context to provide the right behavior, because of the tree structure. Then decide which behaviors to provide for the context you detected and done.