Overload a form in symfony -


i overload form of bundle foscomment. know have create new bundle comment or if can working/main bundle ?

sorry english.

thank you, david

namespace fos\commentbundle\form;  use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; use symfony\component\optionsresolver\optionsresolverinterface;  class commenttype extends abstracttype {     private $commentclass;      public function __construct($commentclass)     {         $this->commentclass = $commentclass;     }      /**      * configures comment form.      *      * @param formbuilderinterface $builder      * @param array                $options      */     public function buildform(formbuilderinterface $builder, array $options)     {         $builder->add('body', 'textarea')                 ->add('lien', 'text', array('required'      => false,                                             'empty_data'    => null));     }      public function setdefaultoptions(optionsresolverinterface $resolver)     {         parent::setdefaultoptions($resolver);         $resolver->setdefaults(array(             'data_class' => $this->commentclass,         ));     }      public function getname()     {         return "fos_comment_comment";     } } 

for moment put field lien directly in vendor file know not way.

i think need override service definition of form want overload:

e.g. (if have services.yml)

fos_comment.form_type.comment.default     class: project/mybundle/form/customformtype     arguments:[%fos_comment.model.comment.class%]     tags:         - { name: form.type, alias: fos_comment_comment } 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -