/** * QuickAdds a Node with POSTed fields. */ public function quickAdd() { try { $this->checkNonce(); $params = $this->Request->getParameters(); $params['_uploadedFiles'] = $this->Request->getUploadedFiles(); if (empty($params['Title'])) { throw new Exception('Title parameter is required', 210); } if (empty($params['ElementSlug'])) { throw new Exception('ElementSlug parameter is required', 220); } $node = $this->MediaService->quickAdd($params); // build output $output = array('totalRecords' => 1, 'nodes' => array()); $c = $this->_buildNodeJSON($node, true, true); $output['nodes'][] = $c; $this->sendJSON($output); } catch (Exception $e) { $this->sendExceptionError($e); } }