Skip to main content

Add Content

An Add Content extension makes it possible for users to easily add content to a supported context (Shared Spaces, Collections, and/or My Files).

Declare in Manifest

The first thing to do when adding an extension is to define it in the manifest.json file:

...
"addContentExtensions": [
{
"extensionKey": "my-add-content-extension",
"name": "My Add Content Extension",
"description": "Super description.",
"icon": "my-extension-icon.png",
"supportedContexts": [
"sharedspace",
"collection",
"myfiles"
],
"resources": {
"folder": "add-content-extension"
}
}
],
...

In this example, the following properties are defined:

PropertyDescription
extensionKeyUnique identifier for the extension.
nameDescriptive name of the extension. This name will be displayed in the Add button of the dropdown in the extension’s specified context.
descriptionBrief overview of the extension's functionality.
iconIcon representing the extension. For optimal rendering in the Asset Viewer sidebar, we recommend your icon be 48x48 pixels.
supportedContextsDefines the contexts in which the user can add content.
resourcesLocation of resources associated with the extension.

Required Files

The source code of your Add Content extension lives in the resources folder that you defined in the manifest. This folder contains all of the files (JS, CS, images, etc.) of your extension. In particular, one main file:

  • index.html - This is the entry point of your Add Content extension.

SDK functions

In order to implement this extension, you'll need to make use of the following SDK functions:

FunctionDescription
addAssetsToCurrentContextThis function adds the selected or generated assets to the current context.
It triggers a modal that prompts the user to confirm the assets to be added. The function returns the slugs of the added assets. After receiving the slugs, you can choose to close the extension via the closeExtension function.
closeExtensionThis function closes the extension after the assets have been added to the current context. If you do not call this function, the modal will remain open, and the user will need to close it manually.