Completed
Push — master ( 9e1211...19df0f )
by Benjamin
02:32
created

BaseBlockEntityAdmin::configureRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
4
namespace Alpixel\Bundle\CMSBundle\Admin;
5
6
use Sonata\AdminBundle\Admin\Admin;
7
use Sonata\AdminBundle\Datagrid\ListMapper;
8
use Sonata\AdminBundle\Form\FormMapper;
9
use Sonata\AdminBundle\Route\RouteCollection;
10
11
12
/**
13
 * @author Benjamin HUBERT <[email protected]>
14
 */
15
class BaseBlockEntityAdmin extends Admin
16
{
17
18
    protected function configureRoutes(RouteCollection $collection)
19
    {
20
        $collection->clearExcept(array('edit', 'delete'));
21
    }
22
23
    protected function configureFormFields(FormMapper $formMapper)
24
    {
25
        $container = $this->getConfigurationPool()->getContainer();
26
27
        $realLocales = [];
28 View Code Duplication
        if ($container->hasParameter('lunetics_locale.allowed_locales')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
            $locales = $container->getParameter('lunetics_locale.allowed_locales');
30
            foreach ($locales as $val) {
31
                $realLocales[$val] = $val;
32
            }
33
        } else {
34
            $realLocales['fr'] = 'fr';
35
        }
36
37
        $formMapper
38
            ->add('content', 'ckeditor', [
39
                'label' => 'Contenu',
40
                'required' => true,
41
                'config_name' => 'admin',
42
            ])
43
            ->end();
44
    }
45
}