1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\CMSBundle\Admin; |
4
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Admin\AbstractAdmin; |
6
|
|
|
|
7
|
|
|
abstract class BaseAdmin extends AbstractAdmin |
8
|
|
|
{ |
9
|
|
|
protected $realLocales; |
10
|
|
|
protected $cmsTypes; |
11
|
|
|
protected $blockTypes; |
12
|
|
|
protected $cmsEntityTypes; |
13
|
|
|
|
14
|
|
|
protected function getRealLocales() |
15
|
|
|
{ |
16
|
|
|
if (!empty($this->realLocales)) { |
17
|
|
|
return $this->realLocales; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
$container = $this->getConfigurationPool()->getContainer(); |
21
|
|
|
|
22
|
|
|
if ($container->hasParameter('lunetics_locale.allowed_locales')) { |
23
|
|
|
$locales = $container->getParameter('lunetics_locale.allowed_locales'); |
24
|
|
|
foreach ($locales as $val) { |
25
|
|
|
$this->realLocales[$val] = $val; |
26
|
|
|
} |
27
|
|
|
} else { |
28
|
|
|
$locale = $container->getParameter('default_locale'); |
29
|
|
|
$this->realLocales[$locale] = $locale; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
return $this->realLocales; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
View Code Duplication |
public function getBlockTypes() |
36
|
|
|
{ |
37
|
|
|
if (!empty($this->blockTypes)) { |
38
|
|
|
return $this->blockTypes; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$container = $this->getConfigurationPool()->getContainer(); |
42
|
|
|
$types = $container->getParameter('alpixel_cms.blocks'); |
43
|
|
|
$this->blockTypes = $types; |
44
|
|
|
foreach ($this->blockTypes as $key => $array) { |
45
|
|
|
if ($instanceAdmin = $this->getConfigurationPool()->getAdminByClass($array['class'])) { |
|
|
|
|
46
|
|
|
$this->blockTypes[$key]['admin'] = $instanceAdmin; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
return $this->blockTypes; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
View Code Duplication |
public function getCMSTypes() |
54
|
|
|
{ |
55
|
|
|
if (!empty($this->cmsTypes)) { |
56
|
|
|
return $this->cmsTypes; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
$container = $this->getConfigurationPool()->getContainer(); |
60
|
|
|
$types = $container->getParameter('alpixel_cms.content_types'); |
61
|
|
|
$this->cmsTypes = $types; |
62
|
|
|
foreach ($this->cmsTypes as $key => $array) { |
63
|
|
|
if ($instanceAdmin = $this->getConfigurationPool()->getAdminByClass($array['class'])) { |
|
|
|
|
64
|
|
|
$this->cmsTypes[$key]['admin'] = $instanceAdmin; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
return $this->cmsTypes; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
protected function getCMSEntityTypes() |
72
|
|
|
{ |
73
|
|
|
if (!empty($this->cmsEntityTypes)) { |
74
|
|
|
return $this->cmsEntityTypes; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
$cmsTypes = $this->getCMSTypes(); |
78
|
|
|
$this->cmsEntityTypes = []; |
79
|
|
|
foreach ($cmsTypes as $key => $array) { |
80
|
|
|
$type = lcfirst(substr($array['class'], (strrpos($array['class'], '\\') + 1), strlen($array['class']))); |
81
|
|
|
$this->cmsEntityTypes[$type] = $array['title']; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
return $this->cmsEntityTypes; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function setContentTypes($contentTypes) |
88
|
|
|
{ |
89
|
|
|
$this->cmsTypes = $contentTypes; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function getContentTypes() |
93
|
|
|
{ |
94
|
|
|
return $this->cmsTypes; |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.