本文整理汇总了PHP中Symfony\Component\Form\FormView::hasChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP FormView::hasChildren方法的具体用法?PHP FormView::hasChildren怎么用?PHP FormView::hasChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormView
的用法示例。
在下文中一共展示了FormView::hasChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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() && $view->hasChildren() && $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: buildViewBottomUp
/**
* {@inheritdoc}
*/
public function buildViewBottomUp(FormView $view, FormInterface $form)
{
$view->set('widget', $form->getAttribute('widget'));
if ($view->hasChildren()) {
$pattern = $form->getAttribute('formatter')->getPattern();
// set right order with respect to locale (e.g.: de_DE=dd.MM.yy; en_US=M/d/yy)
// lookup various formats at http://userguide.icu-project.org/formatparse/datetime
if (preg_match('/^([yMd]+).+([yMd]+).+([yMd]+)$/', $pattern)) {
$pattern = preg_replace(array('/y+/', '/M+/', '/d+/'), array('{{ year }}', '{{ month }}', '{{ day }}'), $pattern);
} else {
// default fallback
$pattern = '{{ year }}-{{ month }}-{{ day }}';
}
$view->set('date_pattern', $pattern);
}
}
示例3: buildViewBottomUp
/**
* {@inheritdoc}
*/
public function buildViewBottomUp(FormView $view, FormInterface $form)
{
$view->set('widget', $form->getAttribute('widget'));
$pattern = $form->getAttribute('formatter')->getPattern();
$format = $pattern;
if ($view->hasChildren()) {
// set right order with respect to locale (e.g.: de_DE=dd.MM.yy; en_US=M/d/yy)
// lookup various formats at http://userguide.icu-project.org/formatparse/datetime
if (preg_match('/^([yMd]+).+([yMd]+).+([yMd]+)$/', $pattern)) {
$pattern = preg_replace(array('/y+/', '/M+/', '/d+/'), array('{{ year }}', '{{ month }}', '{{ day }}'), $pattern);
} else {
// default fallback
$pattern = '{{ year }}-{{ month }}-{{ day }}';
}
}
$view->set('date_pattern', $pattern);
$view->set('date_format', $this->convertJqueryDate($pattern));
$view->set('change_month', $form->getAttribute('changemonth'));
$view->set('change_year', $form->getAttribute('changeyear'));
$view->set('min_date', $form->getAttribute('mindate'));
$view->set('max_date', $form->getAttribute('maxdate'));
$view->set('buttonImage', $form->getAttribute('buttonImage'));
$view->set('locale', $this->session->getLocale());
}