本文整理汇总了PHP中Symfony\Component\Form\FormView::getChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP FormView::getChildren方法的具体用法?PHP FormView::getChildren怎么用?PHP FormView::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormView
的用法示例。
在下文中一共展示了FormView::getChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildViewBottomUp
public function buildViewBottomUp(FormView $view, FormInterface $form)
{
foreach ($view->getChildren() as $child) {
/* @var \Symfony\Component\Form\FormView $child */
$child->set('full_name', $child->get('name'));
}
}
示例2: buildViewBottomUp
public function buildViewBottomUp(FormView $view, FormInterface $form)
{
$multipart = false;
foreach ($view->getChildren() as $child) {
if ($child->get('multipart')) {
$multipart = true;
break;
}
}
$view->set('multipart', $multipart);
}
示例3: buildViewBottomUp
/**
* {@inheritdoc}
*/
public function buildViewBottomUp(FormView $view, FormInterface $form)
{
if ($view->get('expanded')) {
// Radio buttons should have the same name as the parent
$childName = $view->get('full_name');
// Checkboxes should append "[]" to allow multiple selection
if ($view->get('multiple')) {
$childName .= '[]';
}
foreach ($view->getChildren() as $childView) {
$childView->set('full_name', $childName);
}
}
}
示例4: collectErrors
private function collectErrors(FormView $form, &$errors)
{
if ($form->get('errors')) {
$errors[] = $form;
}
foreach ($form->getChildren() as $child) {
$this->collectErrors($child, $errors);
}
}
示例5: renderFormRest
protected function renderFormRest(FormView $view, $blockName, array $variables = array())
{
$renderedView = array();
// TODO, here add the rendered views to a form object, or something
foreach ($view->getChildren() as $childView) {
$renderedView[] = $this->renderBlock($childView, 'row');
}
return $renderedView;
}
示例6: hasFormDeepErrors
/**
* @param FormView $form A form.
* @return boolean If the form (taking into account all of its children) has errors.
*/
public function hasFormDeepErrors(FormView $form)
{
if (count($form->get('errors')) > 0) {
return true;
}
foreach ($form->getChildren() as $child) {
if ($this->hasFormDeepErrors($child)) {
return true;
}
}
return false;
}