protected function buildFieldOptions(FcField $fc_field) { $label = $fc_field->getLabel(); if (empty($label)) { $label = false; } return array('label' => $label, 'required' => false, 'constraints' => array(), 'attr' => array('data-type' => $fc_field->getType())); }
protected function addField(FormBuilderInterface $builder, FcField $fc_field) { $field = $this->field_chain->getField($fc_field->getType()); $field->buildField($this->constraint_chain, $builder, $fc_field); }
/** * Returns FormType for a specific field * * @param FcField $field * @param $form_action * @return \Symfony\Component\Form\Form * @throws \Exception */ protected function getFieldFormType(FcField $field, $form_action) { $chain = $this->get('fc.field.chain'); $alias = $field->getType(); if ($chain->hasField($alias)) { $type = new FieldCommonType($form_action, $this->get('translator'), $chain->getParamsBuilder($alias, $this->admin->getSubject())); } else { $custom_widget = FcFormQuery::create()->filterByAlias($alias)->filterByIsWidget(true)->findOne(); if (!$custom_widget instanceof FcForm) { throw new \Exception('Field "' . $alias . '" not found'); } $type = new FieldCustomType($form_action, $this->get('translator')); } return $this->createForm($type, $field); }