Navigation Menu

Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Fixed coding standards & made translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
dantleech committed Apr 20, 2013
1 parent 8c3a5f8 commit e219bc2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 9 additions & 11 deletions Form/Type/RouteTypeType.php
@@ -1,28 +1,26 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Bundle\RoutingExtraBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Locale\Locale;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Translation\TranslatorInterface;

class RouteTypeType extends AbstractType
{
protected $routeTypes;
protected $translator;

public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$choices = array();
foreach ($this->routeTypes as $routeType) {
$choices[$routeType] = 'route_type.'.$routeType;
}

$resolver->setDefaults(array(
'choices' => $this->routeTypes,
'choices' => $choices,
'translation_domain' => 'SymfonyCmfRoutingExtraBundle',
));
}

Expand Down
6 changes: 4 additions & 2 deletions Tests/Form/Type/RouteTypeTypeTest.php
Expand Up @@ -17,13 +17,15 @@ public function testDefaultsSet()
{
$this->type->addRouteType('foobar');
$this->type->addRouteType('barfoo');

$this->ori->expects($this->once())
->method('setDefaults')
->with(array(
'choices' => array(
'foobar' => 'foobar',
'barfoo' => 'barfoo',
'foobar' => 'route_type.foobar',
'barfoo' => 'route_type.barfoo',
),
'translation_domain' => 'SymfonyCmfRoutingExtraBundle',
));

$this->type->setDefaultOptions($this->ori);
Expand Down

0 comments on commit e219bc2

Please sign in to comment.