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


PHP FormInterface::createView方法代码示例

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


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

示例1:

 function it_builds_view(FormConfigInterface $config, FormView $view, FormInterface $form, FormInterface $prototype)
 {
     $form->getConfig()->willReturn($config);
     $config->getAttribute('prototypes')->willReturn(['configuration_kind' => $prototype]);
     $prototype->createView($view)->shouldBeCalled();
     $this->buildView($view, $form, []);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:7,代码来源:PromotionActionCollectionTypeSpec.php

示例2: testProgressToConfirm

 public function testProgressToConfirm()
 {
     $this->form->submit(['_operation' => ['confirm' => '']]);
     $view = $this->form->createView();
     $this->assertCount(2, $view['_operation']);
     $this->assertArrayHasKey('back', $view['_operation']);
     $this->assertArrayHasKey('commit', $view['_operation']);
 }
开发者ID:issei-m,项目名称:confirmable-form,代码行数:8,代码来源:FormTypeOperationExtensionTest.php

示例3: getData

 /**
  * {@inheritdoc}
  */
 public function getData()
 {
     $data = array('form' => $this->form->createView(), 'element' => $this->element);
     if ($this->form->getData()) {
         $data['id'] = $this->element->getDataIndexer()->getIndex($this->form->getData());
     }
     return $data;
 }
开发者ID:kbedn,项目名称:admin-bundle,代码行数:11,代码来源:FormElementContext.php

示例4: testViewData

 public function testViewData()
 {
     $view = $this->form->createView();
     $choices = $view->vars['choices'];
     $data = array();
     foreach ($choices as $choice) {
         $data[] = $choice->data;
     }
     $query = $this->app['eccube.repository.mail_template']->createQueryBuilder('m')->orderBy('m.id', 'ASC')->getQuery();
     $res = $query->getResult();
     // order by されているか
     $this->assertEquals($data, $res);
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:13,代码来源:MailTemplateTypeTest.php

示例5: changePasswordAction

 public function changePasswordAction(Request $request)
 {
     $this->changePasswordForm->handleRequest($request);
     if ($this->changePasswordForm->isValid()) {
         $user = $this->tokenStorage->getToken()->getUser();
         $formData = $this->changePasswordForm->getData();
         $this->eventDispatcher->dispatch(AdminSecurityEvents::CHANGE_PASSWORD, new ChangePasswordEvent($user, $formData['plainPassword']));
         $request->getSession()->invalidate();
         $this->tokenStorage->setToken(null);
         $request->getSession()->getFlashBag()->set('success', 'admin.change_password_message.success');
         return new RedirectResponse($this->router->generate('fsi_admin_security_user_login'));
     }
     return $this->templating->renderResponse($this->changePasswordActionTemplate, array('form' => $this->changePasswordForm->createView()));
 }
开发者ID:szymach,项目名称:admin-security-bundle,代码行数:14,代码来源:AdminController.php

示例6: createAction

 /**
  * {@inheritdoc}
  *
  * @Template
  * @AclAncestor("pim_enrich_variant_group_create")
  */
 public function createAction(Request $request)
 {
     if (!$request->isXmlHttpRequest()) {
         return new RedirectResponse($this->router->generate('pim_enrich_variant_group_index'));
     }
     $group = $this->groupFactory->createGroup('VARIANT');
     $group->setProductTemplate($this->productTemplateBuilder->createProductTemplate());
     if ($this->groupHandler->process($group)) {
         $request->getSession()->getFlashBag()->add('success', new Message('flash.variant group.created'));
         $url = $this->router->generate('pim_enrich_variant_group_edit', ['code' => $group->getCode()]);
         $response = ['status' => 1, 'url' => $url];
         return new Response(json_encode($response));
     }
     return ['form' => $this->groupForm->createView()];
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:21,代码来源:VariantGroupController.php

示例7: createView

 /**
  * Creates a view.
  *
  * @param FormView $parent The parent view
  *
  * @return FormView The view
  */
 public function createView(FormView $parent = null)
 {
     if (null === $parent && $this->parent) {
         $parent = $this->parent->createView();
     }
     $view = new FormView();
     $view->setParent($parent);
     $types = (array) $this->types;
     foreach ($types as $type) {
         $type->buildView($view, $this);
         foreach ($type->getExtensions() as $typeExtension) {
             $typeExtension->buildView($view, $this);
         }
     }
     $childViews = array();
     foreach ($this->children as $key => $child) {
         $childViews[$key] = $child->createView($view);
     }
     $view->setChildren($childViews);
     foreach ($types as $type) {
         $type->buildViewBottomUp($view, $this);
         foreach ($type->getExtensions() as $typeExtension) {
             $typeExtension->buildViewBottomUp($view, $this);
         }
     }
     return $view;
 }
开发者ID:rudott,项目名称:symfony,代码行数:34,代码来源:Form.php

示例8: convertMeta

 /**
  * @param FormInterface $form
  *
  * @return array
  */
 public function convertMeta(FormInterface $form)
 {
     $formView = $form->createView();
     $fields = array();
     foreach ($formView->children as $name => $child) {
         $fields[$name] = array('default' => $child->vars['data'], 'label' => $child->vars['label'], 'required' => $child->vars['required']);
         if (in_array('checkbox', $child->vars['block_prefixes'])) {
             $fields[$name]['type'] = 'checkbox';
         } else {
             if (in_array('password', $child->vars['block_prefixes'])) {
                 $fields[$name]['type'] = 'password';
             } elseif (in_array('choice', $child->vars['block_prefixes'])) {
                 $fields[$name]['type'] = 'choice';
                 $fields[$name]['choices'] = array_values($child->vars['choices']);
             } elseif (in_array('text', $child->vars['block_prefixes'])) {
                 $fields[$name]['type'] = 'text';
             } elseif (in_array('number', $child->vars['block_prefixes'])) {
                 $fields[$name]['type'] = 'text';
             } else {
                 $fields[$name]['type'] = 'form';
                 $fields[$name]['children'] = $this->convertMeta($form->get($name));
             }
         }
     }
     return $fields;
 }
开发者ID:itmox,项目名称:PayumServer,代码行数:31,代码来源:FormToJsonConverter.php

示例9: editAction

 /**
  * Edit a group
  *
  * TODO : find a way to use param converter with interfaces
  *
  * @param Group $group
  *
  * @Template
  * @AclAncestor("pim_enrich_group_edit")
  *
  * @return array
  */
 public function editAction(Group $group)
 {
     if ($this->groupHandler->process($group)) {
         $this->request->getSession()->getFlashBag()->add('success', new Message('flash.group.updated'));
     }
     return ['form' => $this->groupForm->createView(), 'currentGroup' => $group->getId()];
 }
开发者ID:userz58,项目名称:pim-community-dev,代码行数:19,代码来源:GroupController.php

示例10: testViewData

 public function testViewData()
 {
     $view = $this->form->createView();
     $choices = $view->vars['choices'];
     // empty_value
     $this->assertEquals($view->vars['empty_value'], 'form.pref.empty_value');
     $data = array();
     // attrなど含まれているので
     foreach ($choices as $choice) {
         $data[] = $choice->data;
     }
     $query = $this->app['eccube.repository.master.pref']->createQueryBuilder('p')->orderBy('p.rank', 'ASC')->getQuery();
     $pref = $query->getResult();
     // order by されているか
     $this->assertEquals($data, $pref);
 }
开发者ID:hiroyasu55,项目名称:ec-cube,代码行数:16,代码来源:PrefTypeTest.php

示例11:

 function it_builds_view(FormView $view, FormInterface $form, FormConfigInterface $formConfig)
 {
     $form->getConfig()->shouldBeCalled()->willReturn($formConfig);
     $formConfig->getAttribute('prototypes')->shouldBeCalled()->willReturn(['type' => $form]);
     $form->createView($view)->shouldBeCalled();
     $this->buildView($view, $form, []);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:7,代码来源:PriceableTypeExtensionSpec.php

示例12: createView

 /**
  * {@inheritdoc}
  */
 public function createView(FormView $parent = null)
 {
     if (null === $parent && $this->parent) {
         $parent = $this->parent->createView();
     }
     return $this->config->getType()->createView($this, $parent);
 }
开发者ID:senthil-r-wiredelta,项目名称:meilleure-visite,代码行数:10,代码来源:Form.php

示例13: onConfig

 /**
  * @DI\Observe("widget_badge_usage_configuration")
  *
  * @param ConfigureWidgetEvent $event
  */
 public function onConfig(ConfigureWidgetEvent $event)
 {
     $badgeWidgetConfig = $this->badgeWidgetManager->getBadgeUsageConfigForInstance($event->getInstance());
     $this->badgeUsageForm->setData($badgeWidgetConfig);
     $content = $this->templating->render('IcapBadgeBundle:Widget:badge_usage_config.html.twig', ['form' => $this->badgeUsageForm->createView(), 'instance' => $event->getInstance()]);
     $event->setContent($content);
 }
开发者ID:claroline,项目名称:distribution,代码行数:12,代码来源:BadgeUsageWidgetListener.php

示例14: getView

 /**
  * @return FormView
  */
 public function getView()
 {
     if (!$this->view) {
         $this->view = $this->form->createView();
         $this->onCreateView($this->view, $this);
     }
     return $this->view;
 }
开发者ID:Arachne,项目名称:Forms,代码行数:11,代码来源:FormComponent.php

示例15: array

 /**
  * @param \Symfony\Bundle\FrameworkBundle\Templating\EngineInterface $templating
  * @param \Symfony\Component\Form\FormInterface $form
  * @param \Symfony\Component\Form\FormView $formView
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Symfony\Component\HttpFoundation\Response $response
  */
 function it_render_template_with_change_password_form($templating, $form, $formView, $request, $response)
 {
     $form->handleRequest($request)->shouldBeCalled();
     $form->isValid()->shouldBeCalled()->willReturn(false);
     $form->createView()->shouldBeCalled()->willReturn($formView);
     $templating->renderResponse('FSiAdminSecurityBundle:Admin:change_password.html.twig', array('form' => $formView))->shouldBeCalled()->willReturn($response);
     $this->changePasswordAction($request)->shouldReturn($response);
 }
开发者ID:szymach,项目名称:admin-security-bundle,代码行数:15,代码来源:AdminControllerSpec.php


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