CloudCannon provides a good default set of actions in the +Add menu in the collection file list. These actions are generated from schemas configured for that collection. If there are no schemas, actions are generated based on the first file in that collection.
You can override these default actions with the
add_options option when defining your collections.
You can make actions for the current collection, other collections, and external links.
Some example configurations are shown below:
offices collection, this will result in the following menu:
add_options entry has the following options:
The text displayed for the menu item. Defaults to using
name from the matching
schema if set.
The icon next to the text in the menu item. Must match a Material Icon name. Defaults to using
icon from the matching
schema if set, then falls back to
The link that opens when the option is clicked. Can either be an external or internal link. If internal, the link is relative to the current site.
If this is set, the
schema options are ignored. Since this acts as an override, we recommend using those options directly in favor of this if possible.
The editor to open the new file in. Must be one of
visual. Defaults to an appropriate editor for new file’s type if possible. If no default editor can be calculated, or the editor does not support the new file type, a warning is shown in place of the editor.
Enforces a path for new files to be created in, regardless of path the user is currently navigated to within the collection file list. Relative to the
path of the collection defined in
collection. Defaults to the path within the collection the user is currently navigated to.
Sets which collection this action is creating a file in. This is used when matching the value for
schema. Defaults to the containing collection these
add_options are configured in.
The schema that new files are created from with this action. This schema is not restricted to the containing collection, and is instead relative to the collection specified with
collection. Defaults to
default if schemas are configured for the collection.
Although useful, it’s not required to configure schemas for the initial contents of new files.
The path to a file used to populate the initial contents of a new file if no schemas are configured. We recommend using schemas, and this is ignored if a
schema is available.