public function configure(Form $form) { $_this = $this; $route = $form->addOne('route'); $group = $form->addGroup(); $route->setCurrentGroup($group); $form->addText('name', 'Name'); $form->addText('price', 'Price')->setDefaultValue(0)->addCondition($form::FILLED)->addRule($form::FLOAT); $form->addText('rrp', 'RRP')->addCondition($form::FILLED)->addRule($form::FLOAT); $route->addTextArea('notation', 'Description'); $route->addFileEntityInput('photo', 'Image'); $form->addText('inStock', 'In stock')->addCondition($form::FILLED)->addRule($form::FLOAT); $form->addGroup(''); $form->addManyToOne('category', 'Main category'); $form->addManyToMany('categories', 'Next categories'); $form->addGroup(); $form->addManyToMany('labels', 'Labels'); $tags = $form->addContainer('tags'); $tags->setCurrentGroup($group = $form->addGroup()); $form->addGroup('Types'); $form->addTags('typesAsArray', 'Types')->setSuggestCallback(function () use($_this, $form) { $ret = array(); foreach ($_this->getTagsFromCategories($form) as $tag) { $ret[$tag] = $tag; } return $ret; })->setDelimiter('[;]+')->setJoiner(';'); $form->addGroup(); $form->addSaveButton('Save'); }
public function configure(Form $form) { $route = $form->addOne('route'); $group = $form->addGroup(); $form->addText('name', 'Name'); $route->setCurrentGroup($group); $route->addTextArea('description', 'Description')->getControlPrototype()->attrs['class'] = 'input-block-level'; $route->addFileEntityInput('photo', 'Photo'); $form->addManyToOne('parent', 'Parent'); //$form->addManyToMany('types', 'Types'); $form->addTags('typesAsArray', 'Types')->setDelimiter('[;]+')->setJoiner(';'); $form->addSaveButton('Save'); }