Channel Sets
Overview
Channel Sets allow you to save the structure of a Channel as a JSON file and import it elsewhere. The structure of a channel is made up of its Channel Settings, Channel Categories, Channel Fields, and Statuses. When you export your Channel Set, you’re provided with a zip file that contains all of the data needed to recreate that same Channel on any other ExpressionEngine installation by using the Channel Set Import page.
When using Relationships, your Channel Set export will follow all relationships and export them. For example, if you have a Game Channel that has a Team Channel relationship selected, the Team Channel will also be exported. This applies to the Team Channel as well; if that Channel has a Player Channel relationship selected, the Player Channel will be exported.
Channel Set Structure
Channel Sets are zip files containing the following files:
├── channel_set.json
└── custom_fields
└── <field group name>
├── <custom field name>.<fieldtype>
├── <custom field name>.<fieldtype>
└── ...
Custom Fields
Custom fields are all represented as JSON objects. Each custom field exports its own properties, but label
, instructions
, and order
are always included. If after exporting you realize you want to order your fields differently, simply set the order
property in the order you want the field to appear in:
{
"label": "Content",
"instructions": "Content for this blog entry.",
"order": 1,
"search": "y",
"ta_rows": 10,
"settings": {
"field_show_smileys": "n",
"field_show_file_selector": "n",
"field_show_formatting_btns": "n"
}
}
Note: All fieldtypes included in the channel set must already be installed in order to import the channel set.
channel_set.json
Your channel_set.json
file ties everything together. It will contain structural data about channels
, status_groups
, category_groups
, and upload_destinations
.
channels
{
"channels": [
{
"channel_title": "Blog",
"status_group": "Default",
"field_group": "blog",
"cat_groups": [
"Blog"
]
}
],
}
The array of channels will contain objects that represent each Channel. Each Channel has a channel_title
, status_group
, field_group
, and cat_groups
, though they can be empty. In addition, you can supply title_field_label
to change the Title Label on the publish page.
Note: Field groups mentioned in channel_set.json
, but not present in the /custom_fields
folder will be assigned to the channel, but not created. In this case, make it sure they are previously created.
statuses
{
"statuses": [
{
"name": "Default Page",
"highlight": "2051B3"
}
],
}
We don’t export the default “open” or “closed” status, only any additional statuses.
Each object will contain an array of statuses
that have objects defining the status that contain the status
‘s name and optionally the highlight
color.
category_groups
{
"category_groups": [
{
"name": "Blog",
"categories": [
"News",
"Personal",
"Photos",
"Videos",
"Music"
]
}
],
}
The array of category_groups
contains a name
for the category group, and an array of categories
representing the group’s categories.
Note: Nested categories are not currently supported.
upload_destinations
{
"upload_destinations": [
{
"name": "Blog Images",
}
]
}
In the event that there’s a file field that contains a specified upload destination, you’ll find an upload_destinations
object. It contains an object representing upload destinations and those objects contains a name
.
Sample Channel Sets
We created a few sample Channel Sets as examples and starting points. You can find them on GitHub:
- Blog Channel Set: a blog channel with an image, body, and a set of categories
- Portfolio Channel Set: a portfolio channel with support for multiple images and files, along with a brief description and a set of categories
- Event Channel Set: an event channel with location information, contact information, and related events
- Staff Channel Set: a staff channel with email address, phone number, position, and biography
- Game Channel Set: three channels that relate to each other:
- Game is a channel that contains a location, start time and a relationship to select two Teams
- Team is a channel that contains team history, location, a home page, their mascot, and their current Player roster
- Player is a channel that contains a biography, height and weight, position, hometown, and whether they’re currently eligible to play