当前位置: 首页>>代码示例>>PHP>>正文


PHP Form\Forms类代码示例

本文整理汇总了PHP中Symfony\Component\Form\Forms的典型用法代码示例。如果您正苦于以下问题:PHP Forms类的具体用法?PHP Forms怎么用?PHP Forms使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Forms类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new DateTimeJqueryTypeExtension())->addTypeExtension(new DateJqueryTypeExtension())->addTypeExtension(new BirthdayJqueryTypeExtension())->getFormFactory();
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
 }
开发者ID:mcdir,项目名称:SonatraFormExtensionsBundle,代码行数:7,代码来源:BirthdayJqueryTypeExtensionTest.php

示例2: setUp

 protected function setUp()
 {
     $this->factory = Forms::createFormFactoryBuilder()->addTypeExtension(new DataBlockExtension())->getFormFactory();
     $templateRenderer = $this->getMock('Oro\\Bundle\\FormBundle\\Form\\Builder\\TemplateRendererInterface');
     $templateRenderer->expects($this->any())->method('render')->will($this->returnArgument(0));
     $this->builder = new DataBlockBuilder($templateRenderer, 'form');
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:DataBlockBuilderTest.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->translatableType = new TranslatableType();
     $this->translatableResource = $this->createResourceMock();
     $this->translatableFactory = $this->createFactoryMock();
     $this->formFactory = Forms::createFormFactoryBuilder()->addType(new ResourceType())->addType($this->translatableType)->addType(new TranslationsFormsType(new TranslationForm($this->createFormRegistryMock(), $this->createManagerRegistryMock()), new TranslationsFormsListener(), new DefaultProvider(['en', 'fr'], 'en', ['en'])))->addType(new TranslationTestType())->addType(new TranslatableTestType($this->translatableResource, $this->translatableFactory))->getFormFactory();
 }
开发者ID:php-lug,项目名称:lug,代码行数:10,代码来源:TranslatableTypeTest.php

示例4: setUp

 protected function setUp()
 {
     $this->fooGatewayFactoryMock = $this->getMock('Payum\\Core\\GatewayFactoryInterface');
     $registry = $this->getMock('Payum\\Core\\Registry\\GatewayFactoryRegistryInterface');
     $registry->expects($this->any())->method('getGatewayFactory')->with('foo')->willReturn($this->fooGatewayFactoryMock);
     $this->formFactory = Forms::createFormFactoryBuilder()->addType(new GatewayFactoriesChoiceType(array('foo' => 'Foo Factory')))->addType(new GatewayConfigType($registry))->getFormFactory();
 }
开发者ID:piotrantosik,项目名称:Payum,代码行数:7,代码来源:GatewayConfigTypeTest.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $validator = new Validator(new ClassMetadataFactory(new LoaderChain([])), new ConstraintValidatorFactory(), new DefaultTranslator());
     $this->factory = Forms::createFormFactoryBuilder()->addTypeExtension(new DataBlockExtension())->addTypeExtension(new FormTypeValidatorExtension($validator))->getFormFactory();
     $this->type = new EntityType(new ExtendDbIdentifierNameGenerator());
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:EntityTypeTest.php

示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $validator = $this->getMock('Symfony\\Component\\Validator\\ValidatorInterface');
     $validator->expects($this->any())->method('validate')->willReturn([]);
     $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new FormTypeValidatorExtension($validator))->getFormFactory();
 }
开发者ID:stefk,项目名称:CompetencyBundle,代码行数:7,代码来源:FrameworkTypeTest.php

示例7: ajouterAction

 public function ajouterAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $sysmatricule = $this->get('trc_core.matricule');
     $profil = new Profil();
     $formFactory = Forms::createFormFactory();
     $form = $this->get('form.factory')->create(new ProfilType(), $profil);
     if ($form->handleRequest($request)->isValid()) {
         $profil->setMatricule($sysmatricule->matriculeStandard($profil));
         $em->persist($profil);
         $em->flush();
         return $this->redirect($this->generateUrl('trc_admin_profils'));
     }
     $p = 1;
     $nbre = 5;
     $criteres = array();
     if ($request->query->get('p') !== null && !empty($request->query->get('p'))) {
         $p = $request->query->get('p');
     }
     $id = ($p - 1) * $nbre;
     if ($id < 0) {
         $id = 0;
     }
     $profils = $em->getRepository('TRCCoreBundle:Profil')->findBy($criteres, array(), $nbre, $id);
     $servicePagination = $this->get('trc_core.pagination');
     $objet = 'Profil';
     $url = $this->generateUrl('trc_admin_profils');
     $urlRoute = 'trc_admin_profils';
     $pagination = $servicePagination->pagination($objet, $p, $url, $urlRoute, $criteres, $nbre);
     return $this->render('TRCAdminBundle:Profils:ajouter.html.twig', array('form' => $form->createView(), 'profils' => $profils, 'pagination' => $pagination));
 }
开发者ID:junioraby,项目名称:TRDC,代码行数:31,代码来源:ProfilsController.php

示例8: setUp

 protected function setUp()
 {
     if (!class_exists('Symfony\\Component\\EventDispatcher\\EventDispatcher')) {
         $this->markTestSkipped('The "EventDispatcher" component is not available');
     }
     $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->getFormFactory();
 }
开发者ID:JPunto,项目名称:Symfony,代码行数:7,代码来源:FormIntegrationTestCase.php

示例9: setUp

 /**
  * {@inheritdooc}.
  */
 protected function setUp()
 {
     parent::setUp();
     $params = self::$kernel->getContainer()->get('service_container')->getParameter('fm_tinymce');
     $this->tinyMCEtype = new TinyMCEType($params);
     $this->factory = Forms::createFormFactoryBuilder()->addType($this->tinyMCEtype)->getFormFactory();
 }
开发者ID:helios-ag,项目名称:FMTinyMCEBundle,代码行数:10,代码来源:TinyMCETypeTest.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->factory = Forms::createFormFactoryBuilder()->addTypeExtension(new FormTypeValidatorExtension($this->getMock('Symfony\\Component\\Validator\\ValidatorInterface')))->addTypeGuesser($this->getMockBuilder('Symfony\\Component\\Form\\Extension\\Validator\\ValidatorTypeGuesser')->disableOriginalConstructor()->getMock())->getFormFactory();
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
 }
开发者ID:pigroupe,项目名称:SfynxCoreBundle,代码行数:7,代码来源:AbstractTypeWithValidatorExtensionTestCase.php

示例11: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->zoneProvider = $this->getMock('Silvestra\\Component\\Banner\\Provider\\BannerZoneProviderInterface');
     $this->factory = Forms::createFormFactoryBuilder()->addTypeExtension($this->createValidatorExtension())->addTypeGuesser($this->getMockValidatorTypeGuesser())->addTypes(array(new BannerZoneType('Silvestra\\Component\\Banner\\Model\\BannerZone', $this->zoneProvider)))->getFormFactory();
     $this->builder = $this->createFormBuilder();
 }
开发者ID:silvestra,项目名称:banner,代码行数:10,代码来源:BannerZoneTypeTest.php

示例12: getForm

 /**
  * Get form
  *
  * @param Category $category
  *
  * @return \Symfony\Component\Form\Form
  * @throws \Rad\DependencyInjection\Exception\ServiceNotFoundException
  */
 public function getForm(Category $category = null)
 {
     $data = null;
     if ($category) {
         $data = $category->toArray();
     }
     $action = $category ? Container::get('router')->generateUrl(['categories', $data['id']]) : Container::get('router')->generateUrl(['categories']);
     $formFactory = Forms::createFormFactory();
     $options = ['action' => $action, 'method' => $category ? 'PUT' : 'POST'];
     $event = $this->getEventManager()->dispatch(self::EVENT_CATEGORIES_FORM_SCOPE, $this);
     /** @var CategoriesTable $categoriesTable */
     $categoriesTable = TableRegistry::get('Categories.Categories');
     $treeList = $categoriesTable->find('treeList');
     if (!empty($category)) {
         $treeList->where(['id !=' => $data['id']]);
     }
     $formBuilder = $formFactory->createBuilder('form', $data, $options)->add('title', 'text', ['required' => true, 'attr' => ['class' => 'form-control']])->add('slug', 'text', ['required' => true, 'attr' => ['class' => 'form-control']])->add('parent_id', 'choice', ['choices' => $treeList->toArray(), 'empty_data' => null, 'empty_value' => 'No Parent', 'label' => 'Parent', 'required' => false]);
     if (!empty($event->getResult())) {
         $choices = $event->getResult();
         if (!is_array($choices)) {
             $choices = [$choices];
         }
         $formBuilder->add('scope', 'choice', ['choices' => $choices, 'label' => 'Group']);
     }
     return $formBuilder->add('description', 'textarea', ['required' => false, 'attr' => ['class' => 'form-control wysiwyg']])->add('submit', 'submit')->getForm();
 }
开发者ID:radphp,项目名称:categories-bundle,代码行数:34,代码来源:Form.php

示例13: setUp

 /**
  * Prepare tests and include custom form options.
  */
 protected function setUp()
 {
     // add TopicTypeExtension
     $this->factory = Forms::createFormFactoryBuilder()->addExtensions($this->getExtensions())->addTypeExtension(new OptionalTypeExtension())->getFormFactory();
     $this->dispatcher = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
 }
开发者ID:reskume,项目名称:form-bundle,代码行数:10,代码来源:FormTypeTestCase.php

示例14: setUp

 /**
  * {@inheritdooc}.
  */
 public function setUp()
 {
     parent::setUp();
     $ckeditorType = new CkeditorType($this->get('service_container'));
     $this->factory = Forms::createFormFactoryBuilder()->addType($ckeditorType)->getFormFactory();
     $this->formType = method_exists('Symfony\\Component\\Form\\AbstractType', 'getBlockPrefix') ? 'Trsteel\\CkeditorBundle\\Form\\Type\\CkeditorType' : 'ckeditor';
 }
开发者ID:jbartfay,项目名称:TrsteelCkeditorBundle,代码行数:10,代码来源:CkeditorTypeTest.php

示例15: setUp

 /**
  * @throws \Twig_Error_Loader
  */
 protected function setUp()
 {
     // Setup factory for tabs
     $this->tabFactory = Forms::createFormFactory();
     parent::setUp();
     $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig', 'fields.html.twig'));
     if (interface_exists('Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface')) {
         $csrfProviderInterface = 'Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface';
     } else {
         $csrfProviderInterface = 'Symfony\\Component\\Form\\Extension\\Csrf\\CsrfProvider\\CsrfProviderInterface';
     }
     $renderer = new TwigRenderer($rendererEngine, $this->getMock($csrfProviderInterface));
     $this->extension = new FormExtension($renderer);
     $reflection = new \ReflectionClass($renderer);
     $bridgeDirectory = dirname($reflection->getFileName()) . '/../Resources/views/Form';
     $loader = new \Twig_Loader_Filesystem(array($bridgeDirectory, __DIR__ . '/../../Resources/views/Form'));
     $loader->addPath(__DIR__ . '/../../Resources/views', 'MopaBootstrap');
     $environment = new Twig_Environment($loader, array('strict_variables' => true));
     $environment->addExtension(new TranslationExtension(new StubTranslator()));
     $environment->addExtension(new IconExtension('fontawesome'));
     $environment->addExtension(new FormExtension2());
     $environment->addGlobal('global', '');
     $environment->addExtension($this->extension);
     $this->extension->initRuntime($environment);
 }
开发者ID:hirenbhut93,项目名称:MopaBootstrapBundle,代码行数:28,代码来源:AbstractDivLayoutTest.php


注:本文中的Symfony\Component\Form\Forms类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。