Site Plugins

What are site plugins?

A site plugin can contain one or more extensions for Crafter CMS in a single package. These extensions can:

  • Extend Crafter Studio (authoring)

    • Add Studio authoring widgets that drive the Sidebar and other UI elements

    • Add new Form Engine extensions including data sources and components

    • Add server-side code and services that drive the Studio UI extensions

  • Extend Crafter Engine and the site/web application (delivery)

    • Add new content types along with their Groovy controllers and FreeMarker templates

    • Add REST APIs and/or server-side code

    • Add 3rd party integrations to your web app

How do I make my own site plugin?

A site plugin consist of a group of files that are copied to the site repository when installed, to create your own site plugin you only need to copy the files following this structure:

  • craftercms-plugin.yaml: the plugin descriptor, see Crafter CMS Plugin Descriptor for details

  • authoring: contains all files related to Crafter Studio extensions

    • content-types

      • component: contains configuration files for components

      • page: contains configuration files for pages

    • js: contains files for Studio UI plugins, see Crafter Studio Plugins for details

    • scripts

      • classes: contains Groovy classes

      • rest: contains REST Groovy scripts

  • delivery: contains all files related to Crafter Engine extensions

    • templates: contains Freemarker templates

    • static-assets: contains binary files

    • scripts

      • classes: contains Groovy classes

      • components: contains Groovy scripts for components

      • controllers: contains Groovy controllers

      • filters: contains Groovy filters

      • pages: contains Groovy scripts for pages

      • rest: contains Groovy REST scripts

An easy way to develop new plugins is to start with an empty site and when all the files are ready copy them to a new repository following the given structure. However all references should be updated to match the final destination of the file:

Location in the plugin repository

Location in the site repository

authoring/content-types/component/*

/config/studio/content-types/component/<plugin id path>/*

authoring/content-types/page/*

/config/studio/content-types/page/<plugin id path>/*

authoring/js/*

/config/studio/plugins/js/<plugin id path>/*

authoring/scripts/classes/*

/config/studio/plugins/scripts/classes/<plugin id path>/*

authoring/scripts/rest/*

/config/studio/plugins/scripts/rest/<plugin id path>/*

delivery/templates/*

/templates/<plugin id path>/*

delivery/static-assets/*

/static-assets/<plugin id path>/*

delivery/scripts/classes/*

/scripts/classes/<plugin id path>/*

delivery/scripts/components/*

/scripts/components/<plugin id path>/*

delivery/scripts/controllers/*

/scripts/controllers/<plugin id path>/*

delivery/scripts/filters/*

/scripts/filters/<plugin id path>/*

delivery/scripts/pages/*

/scripts/pages/<plugin id path>/*

delivery/scripts/rest/*

/scripts/rest/<plugin id path>/*

Publishing

To publish a plugin in the Crafter CMS Marketplace you can follow the instructions in Create Plugins for the Crafter Marketplace

Installing

Once a site plugin is published to the Crafter CMS Marketplace it can be installed using Crafter Studio user interface or the REST API:

Note

To access the Plugin Management tool or use the install plugin REST API your user needs to have the following permissions:

  • list_plugins

  • install_plugins


  1. Login to Crafter Studio

  2. Open the left sidebar

    Crafter Studio sidebar

  3. Open Site Tools

    Crafter Studio Site Tools

  4. Open Plugin Management

    Crafter Studio Plugin Management

  5. Click Search & install

    Crafter Studio Search Plugins

  6. Install the desired plugins