本文整理汇总了PHP中Symfony\Component\Form\Form::createView方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::createView方法的具体用法?PHP Form::createView怎么用?PHP Form::createView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\Form
的用法示例。
在下文中一共展示了Form::createView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderList
/**
* @param $page
* @param null $template
*
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Exception
*/
public function renderList($page, $template = null)
{
$user = $this->getUser();
$tpl = null === $template ? $this->templatePath . 'list.html.twig' : $template;
if ($this->filterForm) {
$this->filterForm = $this->createForm($this->filterForm);
}
$qb = $this->buildFilterQuery();
$paginator = $this->get('knp_paginator');
$pagination = $paginator->paginate($qb->getQuery(), $page, $this->list_item_per_page, $this->defaultSortList);
return $this->render($tpl, array('user' => $user, 'nbPerPage' => $this->list_item_per_page, 'page' => $page, 'form' => $this->filterForm ? $this->filterForm->createView() : null, 'baseRoute' => $this->baseRoute, 'entityName' => $this->entityName, 'list' => ['records' => $pagination, 'fields' => $this->listColumn, 'parameters' => $this->listConf, 'actions' => $this->listActions], 'actionsList' => $this->actionsList(), 'listTitle' => $this->listTitle));
}
示例2: editAction
/**
* Edit a group type
*
* @param GroupType $groupType
*
* @Template
* @AclAncestor("pim_enrich_group_type_edit")
* @return array
*/
public function editAction(GroupType $groupType)
{
if ($this->groupTypeHandler->process($groupType)) {
$this->addFlash('success', 'flash.group type.updated');
}
return array('form' => $this->groupTypeForm->createView());
}
示例3: getViewFiltersForm
/**
* getViewFiltersForm
*
* @return \Symfony\Component\Form\Form::createView or false
*/
protected function getViewFiltersForm()
{
if ($this->filter_fields) {
return $this->filter_form->createView();
}
return false;
}
示例4: getFormView
/**
* @return FormView
*/
public function getFormView()
{
if (is_null($this->formView)) {
$this->formView = $this->form->createView();
}
return $this->formView;
}
示例5: editAction
/**
* Edit a family
*
* TODO : find a way to use param converter with interfaces
*
* @param Family $family
*
* @Template
* @AclAncestor("pim_enrich_family_index")
*
* @return array
*/
public function editAction(Family $family)
{
if ($this->familyHandler->process($family)) {
$this->addFlash('success', 'flash.family.updated');
}
return ['form' => $this->familyForm->createView(), 'attributesForm' => $this->getAvailableAttributesForm($family->getAttributes()->toArray())->createView(), 'channels' => $this->channelManager->getChannels()];
}
示例6: editAction
/**
* Edit a group
*
* TODO : find a way to use param converter with interfaces
*
* @param Group $group
*
* @Template
* @AclAncestor("pim_enrich_group_edit")
*
* @return array
*/
public function editAction(Group $group)
{
if ($this->groupHandler->process($group)) {
$this->addFlash('success', 'flash.group.updated');
}
return ['form' => $this->groupForm->createView(), 'currentGroup' => $group->getId()];
}
示例7: editAction
/**
* Edit a group type
*
* @param GroupType $groupType
*
* @Template
* @AclAncestor("pim_enrich_grouptype_edit")
*
* @return array
*/
public function editAction(GroupType $groupType)
{
if ($this->groupTypeHandler->process($groupType)) {
$this->request->getSession()->getFlashBag()->add('success', new Message('flash.group type.updated'));
}
return ['form' => $this->groupTypeForm->createView()];
}
示例8: assertViewIsValid
protected function assertViewIsValid(Form $form, array $formData)
{
$view = $form->createView();
$children = $view->children;
foreach (array_keys($formData) as $key) {
$this->assertArrayHasKey($key, $children);
}
}
示例9: editAction
/**
* Edit attribute form
*
* @param int $id
*
* @Template("PimEnrichBundle:Attribute:form.html.twig")
* @AclAncestor("pim_enrich_attribute_edit")
*
* @return array
*/
public function editAction(Request $request, $id)
{
$attribute = $this->findAttributeOr404($id);
if ($this->attributeHandler->process($attribute)) {
$request->getSession()->getFlashBag()->add('success', new Message('flash.attribute.updated'));
}
return ['form' => $this->attributeForm->createView(), 'locales' => $this->localeRepository->getActivatedLocaleCodes(), 'disabledLocales' => $this->localeRepository->findBy(['activated' => false]), 'measures' => $this->measuresConfig, 'created' => $this->versionManager->getOldestLogEntry($attribute), 'updated' => $this->versionManager->getNewestLogEntry($attribute)];
}
示例10: editAction
/**
* Edit channel
*
* @param Channel $channel
*
* @Template
* @AclAncestor("pim_enrich_channel_edit")
* @return array
*/
public function editAction(Channel $channel)
{
if ($this->channelHandler->process($channel)) {
$this->addFlash('success', 'flash.channel.saved');
return $this->redirect($this->generateUrl('pim_enrich_channel_edit', array('id' => $channel->getId())));
}
return array('form' => $this->channelForm->createView());
}
示例11: editAction
/**
* Edit channel
*
* @param Channel $channel
*
* @Template
* @AclAncestor("pim_enrich_channel_edit")
*
* @return array
*/
public function editAction(Channel $channel)
{
if ($this->channelHandler->process($channel)) {
$this->request->getSession()->getFlashBag()->add('success', new Message('flash.channel.saved'));
return new RedirectResponse($this->router->generate('pim_enrich_channel_edit', ['id' => $channel->getId()]));
}
return ['form' => $this->channelForm->createView()];
}
示例12: editAction
/**
* Edit attribute form
*
* @param Request $request
* @param integer $id
*
* @Template("PimEnrichBundle:Attribute:form.html.twig")
* @AclAncestor("pim_enrich_attribute_edit")
* @return array
*/
public function editAction(Request $request, $id)
{
$attribute = $this->findAttributeOr404($id);
if ($this->attributeHandler->process($attribute)) {
$this->addFlash('success', 'flash.attribute.updated');
return $this->redirectToRoute('pim_enrich_attribute_edit', array('id' => $attribute->getId()));
}
return array('form' => $this->attributeForm->createView(), 'locales' => $this->localeManager->getActiveLocales(), 'disabledLocales' => $this->localeManager->getDisabledLocales(), 'measures' => $this->measuresConfig, 'created' => $this->versionManager->getOldestLogEntry($attribute), 'updated' => $this->versionManager->getNewestLogEntry($attribute));
}
示例13: editAction
/**
* Edit attribute group
*
* @param AttributeGroup $group
*
* @Template
* @AclAncestor("pim_enrich_attributegroup_edit")
*
* @return array
*/
public function editAction(AttributeGroup $group)
{
$groups = $this->attributeGroupRepo->getIdToLabelOrderedBySortOrder();
if ($this->formHandler->process($group)) {
$this->request->getSession()->getFlashBag()->add('success', new Message('flash.attribute group.updated'));
return new RedirectResponse($this->router->generate('pim_enrich_attributegroup_edit', ['id' => $group->getId()]));
}
return ['groups' => $groups, 'group' => $group, 'form' => $this->form->createView(), 'attributesForm' => $this->getAvailableAttributesForm($this->getGroupedAttributes())->createView()];
}
示例14: editAction
/**
* Edit attribute group
*
* @param AttributeGroup $group
*
* @Template
* @AclAncestor("pim_enrich_attributegroup_edit")
*
* @return array
*/
public function editAction(AttributeGroup $group)
{
$groups = $this->attributeGroupRepo->getIdToLabelOrderedBySortOrder();
if ($this->formHandler->process($group)) {
$this->addFlash('success', 'flash.attribute group.updated');
return $this->redirectToRoute('pim_enrich_attributegroup_edit', ['id' => $group->getId()]);
}
return ['groups' => $groups, 'group' => $group, 'form' => $this->form->createView(), 'attributesForm' => $this->getAvailableAttributesForm($this->getGroupedAttributes())->createView()];
}
示例15: transform
public function transform(Form $form)
{
$formView = $form->createView();
$question = new AlwaysReturnKeyOfChoiceQuestion($this->questionFrom($form), $formView->vars['choices'], $this->defaultValueFrom($form));
if ($form->getConfig()->getOption('multiple')) {
$question->setMultiselect(true);
}
return $question;
}