Some Extension ideas
Not officially supported by Contentstack
The built-in select field in Contentstack does not give the user the chance to have key values in the select field. This custom extension is a dropdown field (single choice) that separates the key (label shown to the editor) and value (Actual value that the API sees).
Config Parameter Example:
{
"One": 1,
"Two": 2,
"Three": 3
}
The key is what the editor sees. The value is the actual JSON value.
NOTE: Set the "Field data type" in Contentstack to match the type definition of the value in the config parameters above. This example uses Number
ANOTHER NOTE: Change every mention of the config
, from extensionField.config
to extensionField.fieldConfig
if you want to define the available options inside the content type builder instead of in the extension itself.
A key value field that looks up entries of defined content type and language in an different stack (can be configured to use the same stack).
Fetches a field value from the external entry. Example content type definition included in the folder (key-value-from-a-different-stack/key_value_lookup.json) and can be imported via Contentstack web application UI.
Extension Config Parameter Example:
{
"region": "https://eu-cdn.contentstack.com/v3", // or https://cdn.contentstack.io/v3
"api_key": "<stack api key>",
"access_token": "<environment delivery token)",
"content_type": "key_value_lookup",
"environment": "<environment name - e.g. development>",
"locale": "<locale - e.g. en-us>"
}
A preview of the image in the entry - Just a bigger view. Using the image delivery API.
Config Parameter Example:
{
"imageField": "image",
"region": "https://eu-images.contentstack.com"
}
imageField
is just the uid of the image field that the preview will be created from.
region
can be https://eu-images.contentstack.com or https://images.contentstack.io
https://quilljs.com/ - Custom field RTE
https://summernote.org/ - Custom field RTE
Shows the value of some entry in the master language. Nice to have in localized versions of entries if you quickly want to see a field value from the master language.
Config Parameter Example:
{
"field_uid": "textfield",
"master_locale": "en-us"
}
field_uid
is the field you want to show the value from
Shows all available nested references from the current entry. Current limitations:
- It does not publish the current entry.
- It does not publish the current entry assets.
- Currently it uses on change to check for reference updates, so it checks for everytime a field changes (obviously not good). Needs to be updated to check only when references change.
Config Parameter Example:
{
"environments": [
"production",
"staging"
],
"locales": [
"en-us"
]
}
This is a workaround to restrict Dashboard extension view based on custom role
- Create a custom role (suppose i.e Access to DB Extension) and assign this role to stack users whom you want to give access to the specific DB extension.
- Set hosted method as Hosted by Contentstack
- Use Html Code in Dashboard-Extension-role-based-access Folder and use it in your Dashboard Extension to check if logged in stack user is having access or not i.e if isDBExtensionAccess is true then you can write code for conditionally display Dashboard extensions view.
- Even you can do diffrent Functionality or view for diffrent custom Roles by conditional rendering.
- You can also use extension Config to have array of roles or roles-uid to be restricted and write some code to restrict them.
In case you need for example a uid that remains the same between shared stacks when the entries are the same.
Value is enriched when entry is created. Field is readonly so editors cannot change it. It can easily be extended to be hidden from them as well. The extension checks if the field has any value and creates it if it's missing.
Limitation - To be fixed: If the entry is created by copying another entry, the value will remain the same between entries.
Steps:
- Set Field data type of Extension as 'Text'.
- Choose Hosting Method as 'Hosted by Contentstack'.
- Add Html Code in Extension source code.
- Add this custom field in your desired content-type, This field only allows field value set for Version 1 of Entry after that this field will be disabled for edit.
Use Cases:
- To restrict the value of field which are directly created in Content Type so after its version 1, no one should edit it.
Steps:
- Set Field data type of Extension as 'Text'.
- Choose Hosting Method as 'Hosted by Contentstack'.
- Add Html Code in Extension source code.
- Add this custom field in your desired content-type, This field only allows field value set for Version 1 of Entry after that this field will be disabled for edit.
Use Cases:
- To always restrict the value of field which are directly created in Content Type including the first version; no one can edit it and it's expected to be populated via an external system via CMA or by Contentstack Automation Hub according to required business logice.
Steps:
- Set Field data type of Extension as 'Text'.
- Choose Hosting Method as 'Hosted by Contentstack'.
- Add Html Code in Extension source code.
- Add this custom field in your desired content-type, on check of custom checkbox extension will copy data from one field to another field based on field config parameters.
Config Parameter Example:
{
"from":"desktop",
"to":"tablet"
}
Use Cases:
- We need to have the possibility to copy content for different Device (Desktop to mobile and vice versa)
Steps:
- Set Field data type of Extension as 'Text'.
- Choose Hosting Method as 'Hosted by Contentstack'.
- Add Html Code in Extension source code.
- Add Config parameter
Config Parameter Example:
{
"fieldUid":"title" // your field UID
}
- Add this custom field with UID as 'validation' and
Mandatory
checked in the Advance field setting in your desired content type, This field only allows you to publish if the title value is 'Hello world' otherwise, it will show the validation error message.
This custom field extension converts a Word Document ending with .docx to HTML.
Steps:
- Set Field data type of Extension as 'Text'.
- Choose Hosting Method as 'Hosted by Contentstack'.
- Add Html Code in Extension source code.
Note:
The layout will remain in place, slight CSS implementation will be needed on the client-side web application to make it look presentable.
Live demo: https://docx-to-html.vercel.app/
Example screenshot
This sidebar allows copying field values between translations
Example screenshot