|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Sonata Project package. |
|
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\SeoBundle\Block\Breadcrumb; |
|
13
|
|
|
|
|
14
|
|
|
use Knp\Menu\FactoryInterface; |
|
15
|
|
|
use Knp\Menu\Provider\MenuProviderInterface; |
|
16
|
|
|
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Abstract class for breadcrumb menu services. |
|
20
|
|
|
* |
|
21
|
|
|
* @author Sylvain Deloux <[email protected]> |
|
22
|
|
|
* |
|
23
|
|
|
* @deprecated since 3.x, to be removed with 4.0. |
|
24
|
|
|
*/ |
|
25
|
|
|
abstract class BaseBreadcrumbMenuBlockService extends AbstractBreadcrumbMenuService |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* @var string |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $context; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param string $context |
|
34
|
|
|
* @param string $name |
|
35
|
|
|
* @param EngineInterface $templating |
|
36
|
|
|
* @param MenuProviderInterface $menuProvider |
|
37
|
|
|
* @param FactoryInterface $factory |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct($context, $name, EngineInterface $templating, MenuProviderInterface $menuProvider, FactoryInterface $factory) |
|
|
|
|
|
|
40
|
|
|
{ |
|
41
|
|
|
@trigger_error( |
|
|
|
|
|
|
42
|
|
|
'The '.__CLASS__.' class is deprecated since 3.x, to be removed in 4.0. '. |
|
43
|
|
|
'Use '.AbstractBreadcrumbMenuService::class.' instead.', |
|
44
|
|
|
E_USER_DEPRECATED |
|
45
|
|
|
); |
|
46
|
|
|
|
|
47
|
|
|
parent::__construct($name, $context, $templating, $factory); |
|
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
$this->context = $context; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Return true if current BlockService handles the given context. |
|
54
|
|
|
* |
|
55
|
|
|
* @param string $context |
|
56
|
|
|
* |
|
57
|
|
|
* @return bool |
|
58
|
|
|
*/ |
|
59
|
|
|
public function handleContext($context) |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->context === $context; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return string |
|
66
|
|
|
*/ |
|
67
|
|
|
protected function getContext() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->context; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* {@inheritdoc} |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getName() |
|
76
|
|
|
{ |
|
77
|
|
|
return sprintf('Breadcrumb %s', $this->getContext()); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.