public function actionExport() { $this->requirePostRequest(); $result = new ArtVandelay_ExportedDataModel(array('assets' => $this->_exportAssets(), 'categories' => $this->_exportCategories(), 'fields' => $this->_exportFields(), 'globals' => $this->_exportGlobals(), 'sections' => $this->_exportSections(), 'tags' => $this->_exportTags())); $json = $result->toJson(); if (craft()->request->getParam('download')) { HeaderHelper::setDownload('export.json', strlen($json)); } JsonHelper::sendJsonHeaders(); echo $json; craft()->end(); }
public function loadFromJson($json) { $data = ArtVandelay_ExportedDataModel::fromJson($json); foreach ($data->fields as $group) { $group['notes'] = "HEY"; } return $data; }