diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-05-27 10:27:51 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2017-05-27 10:27:51 -0700 |
commit | 78de7ed98abff93fe5fef94907bcfa4f76dcef07 (patch) | |
tree | f58578554dc829a046762e588d8b190af89dd992 /docs/src/Interfaces/Format.md | |
parent | 38aa0ebb1df97ff185d84da2d3c2f9a11888729b (diff) |
adding docs to repo
Diffstat (limited to 'docs/src/Interfaces/Format.md')
-rw-r--r-- | docs/src/Interfaces/Format.md | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/docs/src/Interfaces/Format.md b/docs/src/Interfaces/Format.md new file mode 100644 index 0000000..8a259d3 --- /dev/null +++ b/docs/src/Interfaces/Format.md @@ -0,0 +1,48 @@ +title: Format Package Interfaces + +Ponzu provides a set of interfaces from the `management/format` package which +determine how content data should be converted and formatted for exporting via +the Admin interface. + +--- + +## Interfaces + +### [format.CSVFormattable](https://godoc.org/github.com/ponzu-cms/ponzu/management/format#CSVFormattable) + +CSVFormattable controls if an "Export" button is added to the contents view for +a Content type in the CMS to export the data to CSV. If it is implemented, a +button will be present beneath the "New" button per Content type. + +##### Method Set + +```go +type CSVFormattable interface { + FormatCSV() []string +} +``` + +##### Implementation + +```go +func (p *Post) FormatCSV() []string { + // []string contains the JSON struct tags generated for your Content type + // implementing the interface + return []string{ + "id", + "timestamp", + "slug", + "title", + "photos", + "body", + "written_by", + } +} +``` + +!!! note "FormatCSV() []string" + Just like other Ponzu content extension interfaces, like `Push()`, you will + return the JSON struct tags for the fields you want exported to the CSV file. + These will also be the "header" row in the CSV file to give titles to the file + columns. Keep in mind that all of item.Item's fields are available here as well. + |