Skip to content

Commit

Permalink
use of typicms.locales config
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Feb 25, 2021
1 parent de4e5fa commit f5c32a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/TranslatableBootFormsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public function register()
// Override BootForm's form builder in order to get model binding
// between BootForm & TranslatableBootForm working.
$this->app->singleton('typicms.form', function ($app) {
$locales = array_keys(config('typicms.locales', []));
if (empty($locales)) {
$locales = config('translatable-bootforms.locales');
}
$formBuilder = new FormBuilder();
$formBuilder->setLocales(config('translatable-bootforms.locales'));
$formBuilder->setLocales($locales);
$formBuilder->setErrorStore($app['typicms.form.errorstore']);
$formBuilder->setOldInputProvider($app['typicms.form.oldinput']);
$formBuilder->setToken($app['session.store']->token());
Expand Down
2 changes: 1 addition & 1 deletion tests/TestTranslatableBootForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function setUp(): void
{
parent::setUp();

$this->app['config']->set('translatable-bootforms.locales', ['en', 'nl']);
$this->app['config']->set('typicms.locales', ['en' => 'en_US', 'nl' => 'nl_NL']);
$this->app['config']->set('translatable-bootforms.label-locale-indicator', '%label (%locale)');

$this->bootform = $this->app->make('typicms.bootform');
Expand Down

0 comments on commit f5c32a3

Please sign in to comment.