Permalink
Browse files

Always get the form type using the LegacyFormHelper

  • Loading branch information...
1 parent 0665717 commit 6f0ee4e3a3638d541826af1c60ad0d9e502919f8 @javiereguiluz committed Dec 30, 2016
Showing with 4 additions and 7 deletions.
  1. +2 −6 Controller/AdminController.php
  2. +1 −1 Form/Extension/EasyAdminExtension.php
  3. +1 −0 Form/Util/LegacyFormHelper.php
@@ -587,9 +587,7 @@ protected function createEntityFormBuilder($entity, $view)
{
$formOptions = $this->executeDynamicMethod('get<EntityName>EntityFormOptions', array($entity, $view));
- $formType = LegacyFormHelper::useLegacyFormComponent() ? 'easyadmin' : 'JavierEguiluz\\Bundle\\EasyAdminBundle\\Form\\Type\\EasyAdminFormType';
-
- return $this->get('form.factory')->createNamedBuilder(mb_strtolower($this->entity['name']), $formType, $entity, $formOptions);
+ return $this->get('form.factory')->createNamedBuilder(mb_strtolower($this->entity['name']), LegacyFormHelper::getType('easyadmin'), $entity, $formOptions);
}
/**
@@ -664,9 +662,7 @@ protected function createDeleteForm($entityName, $entityId)
->setAction($this->generateUrl('easyadmin', array('action' => 'delete', 'entity' => $entityName, 'id' => $entityId)))
->setMethod('DELETE')
;
-
- $submitButtonType = LegacyFormHelper::useLegacyFormComponent() ? 'submit' : 'Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType';
- $formBuilder->add('submit', $submitButtonType, array('label' => 'delete_modal.action', 'translation_domain' => 'EasyAdminBundle'));
+ $formBuilder->add('submit', LegacyFormHelper::getType('submit'), array('label' => 'delete_modal.action', 'translation_domain' => 'EasyAdminBundle'));
return $formBuilder->getForm();
}
@@ -84,6 +84,6 @@ public function setRequest(Request $request = null)
*/
public function getExtendedType()
{
- return LegacyFormHelper::useLegacyFormComponent() ? 'form' : 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType';
+ return LegacyFormHelper::getType('form');
}
}
@@ -55,6 +55,7 @@
'timezone' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType',
'url' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType',
// EasyAdmin custom types
+ 'easyadmin' => 'JavierEguiluz\\Bundle\\EasyAdminBundle\\Form\\Type\\EasyAdminFormType',
'easyadmin_autocomplete' => 'JavierEguiluz\\Bundle\\EasyAdminBundle\\Form\\Type\\EasyAdminAutocompleteType',
'easyadmin_divider' => 'JavierEguiluz\\Bundle\\EasyAdminBundle\\Form\\Type\\EasyAdminDividerType',
'easyadmin_group' => 'JavierEguiluz\\Bundle\\EasyAdminBundle\\Form\\Type\\EasyAdminGroupType',

0 comments on commit 6f0ee4e

Please sign in to comment.