當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。