Skip to content

Add-ons with the new builder #673

Open
@LeonardoGentile

Description

@LeonardoGentile

Hello,
I've read the documentation on extending schema form and at the same time I've seen the source code of some add-ons.

There is quite some confusion about the old and new way of building add-ons, and it seems there is no transition documentations about it (or I've missed it).

For example, many addons uses something like this:

schemaFormDecoratorsProvider.addMapping(
      'bootstrapDecorator',
      'awesome',
       'templates/my/addon.html',
);

while in the docs it is a bit different:

schemaFormDecoratorsProvider.defineAddOn(
    'bootstrapDecorator',         // Name of the decorator you want to add to.
    'awesome',                    // Form type that should render this add-on
    'templates/my/addon.html',    // Template name in $templateCache
    sfBuilderProvider.stdBuilders // List of builder functions to apply.
  );

which one to use? What's the difference? Is the 4th argument optional?

Then, in many example I've seen:

schemaFormDecoratorsProvider.createDirective(
      'awesome',
      'templates/my/addon.html'
 );

but inspecting the source code of ASF I could read this:

  /**************************************************
   * DEPRECATED                                     *
   * The new builder and sf-field is preferred, but *
   * we keep this in during a transitional period   *
   * so that add-ons that don't use the new builder *
   * works.                                         *
   **************************************************/
   //TODO: Move to a compatability extra script.
   var createDirective = function(name) {

so it seems deprecated, how the preferred sf-field is supposed to be used instead?

Could you please update the doc or give a brief explanation here?
Even better an example of an add-on entirely written to be specific for the new builder.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions