/** * Create or edit an item type. * * @param integer|string $id The id of the item type entry. May be a string * if a new item type is created. Otherwise it's * an integer. * @param array $data The data for the item type. * * @return void */ protected function editItem($id, $data) { if ($id == 'new') { $response = array('ok' => \Model\Technique::create($data)); } else { $technique = \Model\Technique::loadById($id); $response = array('ok' => $technique->update($data), 'data' => $technique->getAsArray()); } $this->echoAjaxResponse($response); }