Completed
Push — master ( 911e62...03d227 )
by David
7s
created

LocaleSwitcherBlockService::setDefaultSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata project.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\TranslationBundle\Block;
13
14
use Sonata\BlockBundle\Block\BaseBlockService;
15
use Sonata\BlockBundle\Block\BlockContextInterface;
16
use Symfony\Component\HttpFoundation\Response;
17
use Symfony\Component\OptionsResolver\OptionsResolver;
18
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
19
20
/**
21
 * @author Nicolas Bastien <[email protected]>
22
 */
23
class LocaleSwitcherBlockService extends BaseBlockService
24
{
25
    /**
26
     * @deprecated Will be removed when upgrading to SonataBlockBundle 3
27
     */
28
    public function setDefaultSettings(OptionsResolverInterface $resolver)
29
    {
30
        $this->configureSettings($resolver);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function configureSettings(OptionsResolver $resolver)
37
    {
38
        $resolver->setDefaults(
39
            array(
40
                'admin'                 => null,
41
                'object'                => null,
42
                'template'              => 'SonataTranslationBundle:Block:block_locale_switcher.html.twig',
43
                'locale_switcher_route' => null,
44
            )
45
        );
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function execute(BlockContextInterface $blockContext, Response $response = null)
52
    {
53
        return $this->renderPrivateResponse($blockContext->getTemplate(), array(
54
            'block_context'  => $blockContext,
55
            'block'          => $blockContext->getBlock(),
56
        ), $response);
57
    }
58
}
59