/** * A wizard callback used to install the custom field. * * @param View $view Submitted view * @param array $form Form data * * @return boolean */ public function installField($view, $form) { $path = kirby()->roots()->fields() . DS . 'comments'; $target = new Folder($path); if ($target->exists()) { $view->errors(array('field' => 'A field with the same name already exists.')); return false; } $path = $this->hub()->finder()->resources() . DS . 'fields' . DS . 'comments'; $source = new Folder($path); if (!$source->copy($target->root())) { $view->errors(array('field' => 'Could not copy custom field to target directory. Is the `site` folder writeable?')); return false; } return $this->redirect('home'); }