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


PHP Controller::createForm方法代码示例

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


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

示例1: createForm

 /**
  * @param string|\Symfony\Component\Form\FormTypeInterface $type
  * @param null                                             $data
  * @param array                                            $options
  * @param string|null                                      $editionRole
  *
  * @return \Symfony\Component\Form\Form
  */
 public function createForm($type, $data = null, array $options = array(), $editionRole = null)
 {
     if (!isset($options['disabled']) && !is_null($editionRole)) {
         $options['disabled'] = !$this->get('security.authorization_checker')->isGranted($editionRole, $data);
     }
     return parent::createForm($type, $data, $options);
 }
开发者ID:open-orchestra,项目名称:open-orchestra-cms-bundle,代码行数:15,代码来源:AbstractAdminController.php

示例2: getUploadForms

 public static function getUploadForms(Controller $controller)
 {
     $formImage = $controller->createForm(new ImageMediaFormType(), new Image(), array());
     // 		$formMultipleFiles = $controller->createForm ( new ImageMediaMultipleFormType (), array (), array () );
     return array($formImage->createView());
     return $formMultipleFiles->createView();
 }
开发者ID:mgerdzhev,项目名称:WebImageAnnotator,代码行数:7,代码来源:MediaChooserGatewayController.php

示例3: createNewForm

 public static function createNewForm(Controller $controller, Spot $spot)
 {
     $infoSpot = new InfoSpot();
     $form = $controller->createForm(InfoSpotType::class, $infoSpot, array('action' => $controller->generateUrl('_bo_ajax_spot_add_spot_info', array('id' => $spot->getId())), 'method' => 'POST'));
     $form->add('Create', SubmitType::class, array('label' => 'Create', 'attr' => array('class' => 'btn btn-default pull-right')));
     return $form;
 }
开发者ID:lapoiz,项目名称:WindServer2,代码行数:7,代码来源:ManageInfoSpot.php

示例4: testCreateForm

 public function testCreateForm()
 {
     $form = $this->getMock('Symfony\\Component\\Form\\FormInterface');
     $formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
     $formFactory->expects($this->once())->method('create')->willReturn($form);
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $container->expects($this->at(0))->method('get')->will($this->returnValue($formFactory));
     $controller = new Controller();
     $controller->setContainer($container);
     $this->assertEquals($form, $controller->createForm('foo'));
 }
开发者ID:neartux,项目名称:visitayucatan2.0,代码行数:11,代码来源:ControllerTest.php

示例5: createForm

 /**
  * {@inheritdoc}
  */
 public function createForm($type, $data = null, array $options = array())
 {
     $this->checkCsrf($options);
     return parent::createForm($type, $data, $options);
 }
开发者ID:tamcy,项目名称:json-form,代码行数:8,代码来源:JsonController.php

示例6: createForm

 public function createForm($type, $data = null, array $options = array())
 {
     return parent::createForm($type, $data, $options);
 }
开发者ID:symfony,项目名称:symfony,代码行数:4,代码来源:ControllerTest.php

示例7: getAnnotationForm

 /**
  * An Ajax function that deletes a media with a specific media ID
  * @param Request $request
  * @param unknown_type $mediaId
  */
 public static function getAnnotationForm(Controller $controller)
 {
     $formImage = $controller->createForm(new AnnotationFormType(), new Annotation(), array());
     return array($formImage->createView());
 }
开发者ID:mgerdzhev,项目名称:WebImageAnnotator,代码行数:10,代码来源:AnnotationsGatewayController.php

示例8: createForm

 /**
  * Create form
  */
 public function createForm($type, $data = null, array $options = array())
 {
     $form = parent::createForm($type, $data, $options);
     $this->getEventDispatcher()->dispatch(FormEvent::CREATE, new GenericEvent($form));
     return $form;
 }
开发者ID:7rin0,项目名称:BigfootCoreBundle,代码行数:9,代码来源:BaseController.php


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