本文整理汇总了PHP中Sonata\AdminBundle\Form\FormMapper::add方法的典型用法代码示例。如果您正苦于以下问题:PHP FormMapper::add方法的具体用法?PHP FormMapper::add怎么用?PHP FormMapper::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Form\FormMapper
的用法示例。
在下文中一共展示了FormMapper::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('bg', 'text', array("label" => "Fichier", 'required' => false));
$formMapper->add('name', 'text', array("label" => "Nom de Fichier"));
$formMapper->add('pdf', 'text', array("label" => "Fichier Pdf"));
$formMapper->add('parameters', 'sonata_type_collection', array('by_reference' => false), array('edit' => 'inline', 'inline' => 'table', 'sortable' => 'position'));
}
示例2: configureFormFields
/**
* @param \Sonata\AdminBundle\Form\FormMapper $formMapper
* @return void
*/
protected function configureFormFields(FormMapper $formMapper)
{
if (!$this->isChild()) {
$formMapper->add('post', 'sonata_type_model', array(), array('edit' => 'list'));
// $formMapper->add('post', 'sonata_type_admin', array(), array('edit' => 'inline'));
}
$formMapper->add('name')->add('email')->add('url', null, array('required' => false))->add('message')->add('status', 'choice', array('choices' => Comment::getStatusList(), 'expanded' => true, 'multiple' => false));
}
示例3: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('name')->add('width')->add('length')->add('height');
if ($this->getSubject() && !is_null($this->getSubject()->getId())) {
$formMapper->add('furnitures', 'sonata_type_collection', array('by_reference' => false, 'type_options' => array('delete' => false, 'delete_options' => array('type' => 'hidden', 'type_options' => array('mapped' => false, 'required' => false)))), array('edit' => 'inline', 'inline' => 'table', 'sortable' => 'position'));
}
}
示例4: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('enabled', null, array('required' => false))->add('name')->add('description', 'textarea', array('required' => false))->add('position', 'integer', array('required' => false, 'data' => 0))->add('parent', 'sonata_category_selector', array('category' => $this->getSubject() ?: null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'required' => false));
if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) {
$formMapper->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_category')));
}
}
示例5: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
if ($this->getRequest()->get('_sonata_admin') == 'sonata.admin.indicador_alertas') {
$formMapper->add('indicador', null, array('label' => $this->getTranslator()->trans('indicador')));
}
$formMapper->add('limiteInferior', null, array('label' => $this->getTranslator()->trans('_alerta_limite_inferior_'), 'required' => true))->add('limiteSuperior', null, array('label' => $this->getTranslator()->trans('limite_superior'), 'required' => true))->add('color', null, array('label' => $this->getTranslator()->trans('color'), 'required' => true))->add('comentario', null, array('label' => $this->getTranslator()->trans('comentario')));
}
示例6: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
if (!$this->isChild()) {
$formMapper->add('employee', 'sonata_type_model', array('btn_add' => false));
}
$formMapper->add('startDate', null, array('widget' => 'single_text'))->add('endDate', 'date', array('widget' => 'single_text'));
}
示例7: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('name', 'text', array("label" => "Template"));
$formMapper->add('file', 'file', array("label" => "fichier AI", 'required' => false, 'data_class' => null));
$formMapper->add('width', 'number', array("label" => "largeur"));
$formMapper->add('height', 'number', array("label" => "hauteur"));
}
示例8: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('name')->add('description', 'textarea', array('required' => false))->add('context')->add('enabled', null, array('required' => false));
if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) {
$formMapper->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_collection')));
}
}
示例9: buildCreateForm
/**
* {@inheritdoc}
*/
public function buildCreateForm(FormMapper $formMapper)
{
$formMapper->add('name', null, array('required' => false));
$formMapper->add('description');
$formMapper->add('copyright');
$formMapper->add('binaryContent', 'file', array('constraints' => array(new NotBlank(), new NotNull())));
}
示例10: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
if (!$this->hasParentFieldDescription()) {
$formMapper->add('car', null, array('constraints' => new Assert\NotNull()));
}
$formMapper->add('date', null, array('widget' => 'single_text'))->add('comment');
}
示例11: configureFormFields
/**
* {@inheritdoc}
*/
public function configureFormFields(FormMapper $formMapper)
{
if (!$this->isChild()) {
$formMapper->add('product', 'sonata_type_model_list', array(), array('admin_code' => 'sonata.product.admin.product'));
}
$formMapper->add('category')->add('main')->add('enabled');
}
示例12: configureFormFields
/**
* Конфигурем форму редактирования
*
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
if ($this->useModel()) {
$formMapper->add('Model', 'text', array('disabled' => true, 'required' => false))->add('ObjectId', 'text', array('disabled' => true, 'required' => false))->add('Locale', 'choice', array('label' => 'Локаль', 'required' => false, 'choices' => $this->getLocaleChoices(), 'empty_data' => false));
}
$formMapper->add('OldUrl', 'text', array('label' => 'Старый адрес'))->add('NewUrl', 'text', array('label' => 'Новый адрес', 'required' => false));
}
示例13: configureFormFields
/**
* @param \Sonata\AdminBundle\Form\FormMapper $formMapper
*/
public function configureFormFields(FormMapper $formMapper)
{
if (!$this->isChild()) {
$formMapper->add('product', 'sonata_type_model_list', array(), array('admin_code' => 'sonata.product.admin.product'));
}
$formMapper->add('enabled')->add('code', 'sonata_delivery_choice')->add('perItem')->add('countryCode', 'country')->add('zone');
}
示例14: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('type', 'entity', array('class' => 'AppBundle\\Entity\\JamType', 'property' => 'name'));
$formMapper->add('year', 'entity', array('class' => 'AppBundle\\Entity\\JamYear', 'property' => 'year'));
$formMapper->add('comment', 'text', array('required' => false));
$formMapper->add('amount', 'number', array('mapped' => false, 'data' => 1));
}
示例15: buildForm
public function buildForm(AdminInterface $admin, FormMapper $formMapper)
{
/**
* Bind data to the mapped fields
*/
$formMapper->getFormBuilder()->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $formEvent) {
$data = $formEvent->getData();
$form = $formEvent->getForm();
if ($data instanceof Route) {
$form->get('source')->setData($data->getPath());
$form->get('target')->setData($data->getDefault('path'));
}
});
/**
* Bind the mapped fields to the entity
*/
$formMapper->getFormBuilder()->addEventListener(FormEvents::SUBMIT, function (FormEvent $formEvent) {
$data = $formEvent->getData();
$form = $formEvent->getForm();
if ($data instanceof Route) {
$data->setStaticPrefix($form->get('source')->getData());
$data->setDefault('path', $form->get('target')->getData());
$data->setDefault('_controller', $this->routeController);
$data->setDefault('permanent', true);
}
});
$formMapper->add('source', 'text', ['mapped' => false]);
$formMapper->add('target', 'text', ['mapped' => false]);
$formMapper->remove('staticPrefix');
$formMapper->remove('variablePattern');
}