/** * Add an instance of the selected class * @return void */ public function addInstance() { if (!tao_helpers_Request::isAjax()) { throw new Exception("wrong request mode"); } $response = array(); $clazz = new core_kernel_classes_Class($this->getRequestParameter('id')); $label = $this->service->createUniqueLabel($clazz); $instance = $this->service->createInstance($clazz, $label); if (!is_null($instance) && $instance instanceof core_kernel_classes_Resource) { $response = array('label' => $instance->getLabel(), 'uri' => $instance->getUri()); } $this->returnJson($response); }