If you want to connect an element to a collection field, you must choose whether you want to connect it yourself from the app, or allow site-builders to connect this element on their own. For example if you build an app with complex logic that you need to control, you would probably use the first option. If you build a more design-oriented widget and want to give site-builders the freedom to connect any field they want to the design, your would use the second.
Here are some details about these two options:
You can connect an element to a collection field in Blocks, through adding a dataset. If you do this, note that:
- An outer widget cannot connect an inner-widget’s element to a dataset. You must go into the inner widget and connect the element from there.
- If you connect an app’s element to a dataset, you cannot allow a site builder to connect this element to a collection on their site. Therefore, you will also not be able to add the Connect to CMS action button to this element’s action bar. Note that the action button will be disabled and appear gray.
- Go to the Design tab.
- Click on the element.
- Click on the Connect to CMS icon in the action bar.
- Select a dataset, or add one if you haven't.
- Select the field to connect to your element.
You can also connect the elements through code.
You can also allow site builders to connect app elements to their site’s CMS through the Connect to CMS action button. If you choose to do this, note that:
- Once the app is installed on people's sites and they connect the element to their collections, if you connect the same element to your collection in Blocks, it will break the app’s functionality on their site.
- If you connected an element to your own collection in Blocks, you will not be able to add this action button to the element's action bar.
- Go to the Configuration tab.
- Click on the element.
- Click Edit Action Bar.
- Click + Add.
- Add the Connect to CMS button and accept the notification.