/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $defaultParams = array('wrapper_attr' => array(), 'width' => 1200, 'height' => 400, 'tab_size' => null, 'read_only' => null, 'use_soft_tabs' => true, 'use_wrap_mode' => null, 'show_print_margin' => true, 'highlight_active_line' => true); $defaultParams = array_merge($this->params, $defaultParams); $builder->add('codeMode', 'choice', array('choices' => Solution::getCodeModes()))->add('code', 'ace_editor', $defaultParams); $user = $this->user; $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) use($user) { $item = $event->getData(); $item->setUser($user); }); }
/** * Add solution * * @param Solution $solution Solution * * @return $this */ public function addSolution(Solution $solution) { $solution->setTask($this); $this->solutions->add($solution); return $this; }