本文整理汇总了PHP中Symfony\Component\Form\Form::getForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getForm方法的具体用法?PHP Form::getForm怎么用?PHP Form::getForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\Form
的用法示例。
在下文中一共展示了Form::getForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initForm
protected function initForm()
{
$filters = array();
if ($this->request->cookies->get('filters')) {
$filters = unserialize($this->request->cookies->get('filters'));
}
$date = null;
if (isset($filters['date'])) {
$date = $filters['date'];
}
$this->form = $this->createFormBuilder();
$this->form->setAction($this->generateUrl('datapresentation_filter_set'))->add('siteId', 'text', array('required' => false, 'attr' => array('value' => isset($filters['siteId']) ? $filters['siteId'] : '')))->add('userId', 'text', array('required' => false, 'attr' => array('value' => isset($filters['userId']) ? $filters['userId'] : '')))->add('customerId', 'text', array('required' => false, 'attr' => array('value' => isset($filters['customerId']) ? $filters['customerId'] : '')))->add('productId', 'text', array('required' => false, 'attr' => array('value' => isset($filters['productId']) ? $filters['productId'] : '')))->add('host', 'text', array('required' => false, 'attr' => array('value' => isset($filters['host']) ? $filters['host'] : '')))->add('page', 'text', array('required' => false, 'attr' => array('value' => isset($filters['page']) ? $filters['page'] : '')))->add('pageType', 'text', array('required' => false, 'attr' => array('value' => isset($filters['pageType']) ? $filters['pageType'] : '')))->add('event', 'text', array('required' => false, 'attr' => array('value' => isset($filters['event']) ? $filters['event'] : '')))->add('date', 'date', array('required' => false, 'input' => 'datetime', 'widget' => 'text', 'data' => $date, 'attr' => array('class' => 'date-input')))->add('today', 'checkbox', array('required' => false, 'attr' => array('class' => 'checkbox-input')));
$this->form->add('save', 'submit', array('label' => ' ', 'attr' => array('class' => 'green-button fa fa-list fa-lg', 'title' => 'filter')));
$this->form = $this->form->getForm()->handleRequest($this->request);
$this->formView = $this->form->createView();
}