/**
  * Register form mapping information.
  */
 public function registerFormMapping()
 {
     FormHelper::registerFormTypeMapping(array('sonata_type_admin' => 'Sonata\\AdminBundle\\Form\\Type\\AdminType', 'sonata_type_model' => 'Sonata\\AdminBundle\\Form\\Type\\ModelType', 'sonata_type_model_list' => 'Sonata\\AdminBundle\\Form\\Type\\ModelTypeList', 'sonata_type_model_reference' => 'Sonata\\AdminBundle\\Form\\Type\\ModelReferenceType', 'sonata_type_model_hidden' => 'Sonata\\AdminBundle\\Form\\Type\\ModelHiddenType', 'sonata_type_model_autocomplete' => 'Sonata\\AdminBundle\\Form\\Type\\ModelAutocompleteType', 'sonata_type_native_collection' => 'Sonata\\AdminBundle\\Form\\Type\\CollectionType', 'sonata_type_choice_field_mask' => 'Sonata\\AdminBundle\\Form\\Type\\ChoiceFieldMaskType', 'sonata_type_filter_number' => 'Sonata\\AdminBundle\\Form\\Type\\Filter\\NumberType', 'sonata_type_filter_choice' => 'Sonata\\AdminBundle\\Form\\Type\\Filter\\ChoiceType', 'sonata_type_filter_default' => 'Sonata\\AdminBundle\\Form\\Type\\Filter\\DefaultType', 'sonata_type_filter_date' => 'Sonata\\AdminBundle\\Form\\Type\\Filter\\DateType', 'sonata_type_filter_date_range' => 'Sonata\\AdminBundle\\Form\\Type\\Filter\\DateRangeType', 'sonata_type_filter_datetime' => 'Sonata\\AdminBundle\\Form\\Type\\Filter\\DateTimeType', 'sonata_type_filter_datetime_range' => 'Sonata\\AdminBundle\\Form\\Type\\Filter\\DateTimeRangeType', 'tab' => 'Mopa\\Bundle\\BootstrapBundle\\Form\\Type\\TabType'));
     FormHelper::registerFormExtensionMapping('form', array('sonata.admin.form.extension.field', 'mopa_bootstrap.form.type_extension.help', 'mopa_bootstrap.form.type_extension.legend', 'mopa_bootstrap.form.type_extension.error', 'mopa_bootstrap.form.type_extension.widget', 'mopa_bootstrap.form.type_extension.horizontal', 'mopa_bootstrap.form.type_extension.widget_collection', 'mopa_bootstrap.form.type_extension.tabbed'));
     FormHelper::registerFormExtensionMapping('choice', array('sonata.admin.form.extension.choice'));
     FormHelper::registerFormExtensionMapping('button', array('mopa_bootstrap.form.type_extension.button'));
     FormHelper::registerFormExtensionMapping('date', array('mopa_bootstrap.form.type_extension.date'));
 }
Exemplo n.º 2
0
 /**
  * @param ContainerBuilder $container
  * @param array            $config
  */
 public function configureFormFactory(ContainerBuilder $container, array $config)
 {
     if (!$config['form']['mapping']['enabled'] || version_compare(Kernel::VERSION, '2.8', '<')) {
         $container->removeDefinition('sonata.core.form.extension.dependency');
         return;
     }
     $container->setParameter('sonata.core.form.mapping.type', $config['form']['mapping']['type']);
     $container->setParameter('sonata.core.form.mapping.extension', $config['form']['mapping']['extension']);
     FormHelper::registerFormTypeMapping($config['form']['mapping']['type']);
     foreach ($config['form']['mapping']['extension'] as $ext => $idx) {
         FormHelper::registerFormExtensionMapping($ext, $idx);
     }
     $definition = $container->getDefinition('sonata.core.form.extension.dependency');
     $definition->replaceArgument(4, FormHelper::getFormTypeMapping());
     $definition = $container->getDefinition('sonata.core.form.extension.dependency');
     $definition->replaceArgument(5, FormHelper::getFormExtensionMapping());
 }
Exemplo n.º 3
0
 /**
  * Register form mapping information.
  */
 public function registerFormMapping()
 {
     // symfony
     FormHelper::registerFormTypeMapping(array('form' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', 'birthday' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType', 'checkbox' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType', 'choice' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType', 'collection' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType', 'country' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType', 'date' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType', 'datetime' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType', 'email' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType', 'file' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType', 'hidden' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType', 'integer' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType', 'language' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType', 'locale' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\LocaleType', 'money' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType', 'number' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType', 'password' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType', 'percent' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType', 'radio' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType', 'repeated' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType', 'search' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\SearchType', 'textarea' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextareaType', 'text' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType', 'time' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType', 'timezone' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType', 'url' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType', 'button' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType', 'submit' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType', 'reset' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ResetType', 'currency' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType', 'entity' => 'Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType'));
     // core bundle
     FormHelper::registerFormTypeMapping(array('sonata_type_immutable_array' => 'Sonata\\CoreBundle\\Form\\Type\\ImmutableArrayType', 'sonata_type_boolean' => 'Sonata\\CoreBundle\\Form\\Type\\BooleanType', 'sonata_type_collection' => 'Sonata\\CoreBundle\\Form\\Type\\CollectionType', 'sonata_type_translatable_choice' => 'Sonata\\CoreBundle\\Form\\Type\\TranslatableChoiceType', 'sonata_type_date_range' => 'Sonata\\CoreBundle\\Form\\Type\\DateRangeType', 'sonata_type_datetime_range' => 'Sonata\\CoreBundle\\Form\\Type\\DateTimeRangeType', 'sonata_type_date_picker' => 'Sonata\\CoreBundle\\Form\\Type\\DatePickerType', 'sonata_type_datetime_picker' => 'Sonata\\CoreBundle\\Form\\Type\\DateTimePickerType', 'sonata_type_date_range_picker' => 'Sonata\\CoreBundle\\Form\\Type\\DateRangePickerType', 'sonata_type_datetime_range_picker' => 'Sonata\\CoreBundle\\Form\\Type\\DateTimeRangePickerType', 'sonata_type_equal' => 'Sonata\\CoreBundle\\Form\\Type\\EqualType', 'sonata_type_color_selector' => 'Sonata\\CoreBundle\\Form\\Type\\ColorSelectorType'));
     FormHelper::registerFormExtensionMapping('form', array('form.type_extension.form.http_foundation', 'form.type_extension.form.validator', 'form.type_extension.csrf', 'form.type_extension.form.data_collector', 'sonata.admin.form.extension.field', 'nelmio_api_doc.form.extension.description_form_type_extension', 'mopa_bootstrap.form.type_extension.help', 'mopa_bootstrap.form.type_extension.legend', 'mopa_bootstrap.form.type_extension.error', 'mopa_bootstrap.form.type_extension.widget', 'mopa_bootstrap.form.type_extension.horizontal', 'mopa_bootstrap.form.type_extension.widget_collection', 'mopa_bootstrap.form.type_extension.tabbed'));
     FormHelper::registerFormExtensionMapping('repeated', array('form.type_extension.repeated.validator'));
     FormHelper::registerFormExtensionMapping('submit', array('form.type_extension.submit.validator'));
     if ($this->container && $this->container->hasParameter('sonata.core.form.mapping.type')) {
         // from configuration file
         FormHelper::registerFormTypeMapping($this->container->getParameter('sonata.core.form.mapping.type'));
         foreach ($this->container->getParameter('sonata.core.form.mapping.extension') as $ext => $types) {
             FormHelper::registerFormExtensionMapping($ext, $types);
         }
     }
 }