本文整理匯總了PHP中Symfony\Component\Form\FormView::addChild方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormView::addChild方法的具體用法?PHP FormView::addChild怎麽用?PHP FormView::addChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Form\FormView
的用法示例。
在下文中一共展示了FormView::addChild方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildViewBottomUp
/**
* Adds a CSRF field to the root form view.
*
* @param FormView $view The form view
* @param FormInterface $form The form
*/
public function buildViewBottomUp(FormView $view, FormInterface $form)
{
if (!$view->hasParent() && !$form->getAttribute('single_control') && $form->hasAttribute('csrf_field_name')) {
$name = $form->getAttribute('csrf_field_name');
$csrfProvider = $form->getAttribute('csrf_provider');
$intention = $form->getAttribute('csrf_intention');
$factory = $form->getAttribute('csrf_factory');
$data = $csrfProvider->generateCsrfToken($intention);
$csrfForm = $factory->createNamed('hidden', $name, $data, array('property_path' => false));
$view->addChild($csrfForm->createView($view));
}
}
示例2: testgetChildFormView
public function testgetChildFormView()
{
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
$pool = new Pool($container, 'title', 'logo.png');
$helper = new AdminHelper($pool);
$formView = new FormView('test');
$formView->set('id', 'test');
$child = new FormView('test');
$child->set('id', 'test_elementId');
$formView->addChild($child);
$this->assertNull($helper->getChildFormView($formView, 'foo'));
$this->isInstanceOf('Symfony\\Component\\Form\\FormView', $helper->getChildFormView($formView, 'test_elementId'));
}