本文整理汇总了PHP中Sonata\AdminBundle\Form\FormMapper::setAdminCode方法的典型用法代码示例。如果您正苦于以下问题:PHP FormMapper::setAdminCode方法的具体用法?PHP FormMapper::setAdminCode怎么用?PHP FormMapper::setAdminCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Form\FormMapper
的用法示例。
在下文中一共展示了FormMapper::setAdminCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
// $locale = $this->getConfigurationPool()->getContainer()->get('request_stack')->getCurrentRequest()->getLocale();
// $formMapper->add('translations', 'a2lix_translations');
/* $formMapper
->add('productCategory', 'entity', array(
'required' => true,
'class' => "AppBundle\Entity\ProductCategory",
'query_builder' => function(EntityRepository $er) use ($locale) {
return $er->createQueryBuilder('u')
->join('u.translations', 'ctr')
->where('ctr.locale = :locale')
->orderBy('ctr.name', 'asc')
->setParameter('locale',$locale)
;
},
));
*/
$formMapper->setAdminCode("app.partner");
$formMapper->tab('general')->with('options', array('class' => 'col-md-2'))->add('active', null, array('required' => false), array('admin-code' => 'app.partner'))->add('company', null, array('required' => false))->add('customer', null, array('required' => false, 'attr' => array('class' => 'selling')))->add('supplier', null, array('required' => false, 'attr' => array('class' => 'purchase')))->add('isEmployee', null, array('required' => false, 'attr' => array('class' => 'employee')))->end()->with('name.and.address', array('class' => 'col-md-5'))->add('address', 'text', array('required' => false, 'label' => false, 'mapped' => false, 'attr' => array('class' => 'geocomplete')))->add('name', null, array('attr' => array('data-geo' => 'name')))->add('parent', null, array('label' => 'Company'))->add('addressType', 'choice', array('required' => false, 'choices' => Partner::getAddressTypeChoices()))->add('street', null, array('attr' => array('class' => 'street')))->add('street2', null, array('required' => false, 'attr' => array('class' => 'street2')))->add('zip', null, array('attr' => array('data-geo' => 'postal_code')))->add('city', null, array('attr' => array('data-geo' => 'locality')))->add('state', null, array('attr' => array('data-geo' => 'administrative_area_level_1')))->add('country', 'country', array('label' => 'country', 'attr' => array('class' => 'country')))->end()->with('further.information', array('class' => 'col-md-5'))->add('language', 'locale', array('preferred_choices' => array('de_CH')))->add('phone', null, array('required' => false, 'attr' => array('data-geo' => 'international_phone_number')))->add('fax', null, array('required' => false))->add('mobile', null, array('required' => false))->add('email', null, array('required' => false))->add('website', null, array('required' => false, 'attr' => array('data-geo' => 'website')))->add('optOut', null, array('required' => false))->add('partnerCategory')->end()->end()->tab('selling')->with('selling')->add('deliveryMethod', 'sonata_type_model')->add('creditLimit', null, array('required' => false))->end()->end()->tab('purchase')->with('selling')->add('debitLimit', null, array('required' => false))->end()->end()->tab('employee')->with('employee')->add('employee', 'sonata_type_admin', array('required' => false, 'btn_add' => false, 'btn_delete' => false), array('admin_code' => 'app.employee'))->end()->end()->tab('comments')->with('comments')->add('comment', null, array('required' => false, 'label' => false))->end()->end();
}
示例2: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->setAdminCode("app.supplier");
$formMapper->tab('general')->with('options', array('class' => 'col-md-2'))->add('active', null, array('required' => false))->add('company', null, array('required' => false))->add('customer', null, array('required' => false, 'attr' => array('class' => 'selling')))->add('supplier', null, array('required' => false, 'attr' => array('class' => 'purchase')))->end()->with('name.and.address', array('class' => 'col-md-5'))->add('address', 'text', array('required' => false, 'label' => false, 'mapped' => false, 'attr' => array('class' => 'geocomplete')))->add('name', null, array('attr' => array('data-geo' => 'name')))->add('parent', null, array('label' => 'Company'))->add('addressType', 'choice', array('required' => false, 'choices' => Partner::getAddressTypeChoices()))->add('street', null, array('attr' => array('class' => 'street')))->add('street2', null, array('required' => false, 'attr' => array('class' => 'street2')))->add('zip', null, array('attr' => array('data-geo' => 'postal_code')))->add('city', null, array('attr' => array('data-geo' => 'locality')))->add('state', null, array('attr' => array('data-geo' => 'administrative_area_level_1')))->add('country', 'country', array('label' => 'country', 'attr' => array('class' => 'country')))->end()->with('further.information', array('class' => 'col-md-5'))->add('language', 'locale', array('preferred_choices' => array('de_CH')))->add('phone', null, array('required' => false, 'attr' => array('data-geo' => 'international_phone_number')))->add('fax', null, array('required' => false))->add('mobile', null, array('required' => false))->add('email', null, array('required' => false))->add('website', null, array('required' => false, 'attr' => array('data-geo' => 'website')))->add('optOut', null, array('required' => false))->add('partnerCategory')->end()->end()->tab('selling')->with('selling')->add('deliveryMethod', 'sonata_type_model')->add('creditLimit', null, array('required' => false))->end()->end()->tab('purchase')->with('selling')->add('debitLimit', null, array('required' => false))->end()->end()->tab('comments')->with('comments')->add('comment', null, array('required' => false, 'label' => false))->end()->end();
}