These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\SitemapBundle\Twig; |
||
4 | |||
5 | use Kunstmaan\NodeBundle\Helper\NodeMenuItem; |
||
6 | |||
7 | class SitemapTwigExtension extends \Twig_Extension |
||
0 ignored issues
–
show
|
|||
8 | { |
||
9 | /** |
||
10 | * Returns a list of functions to add to the existing list. |
||
11 | * |
||
12 | * @return array An array of functions |
||
13 | */ |
||
14 | public function getFunctions() |
||
15 | { |
||
16 | return array( |
||
17 | new \Twig_SimpleFunction('hide_from_sitemap', array($this, 'isHiddenFromSitemap')), |
||
18 | new \Twig_SimpleFunction('hide_children_from_sitemap', array($this, 'isHiddenChildrenFromSitemap')), |
||
19 | ); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Returns true when the item should be hidden from the sitemap |
||
24 | * |
||
25 | * @param NodeMenuItem $item |
||
26 | * |
||
27 | * @return \Kunstmaan\NodeBundle\Helper\NodeMenuItem |
||
28 | */ |
||
29 | View Code Duplication | public function isHiddenFromSitemap(NodeMenuItem $item) |
|
30 | { |
||
31 | if (is_subclass_of($item->getNode()->getRefEntityName(), 'Kunstmaan\\SitemapBundle\\Helper\\HiddenFromSitemapInterface')) { |
||
32 | $page = $item->getPage(); |
||
33 | |||
34 | return $page->isHiddenFromSitemap(); |
||
35 | } |
||
36 | |||
37 | return false; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Returns true when the children of the item should be hidden from the sitemap |
||
42 | * |
||
43 | * @param NodeMenuItem $item |
||
44 | * |
||
45 | * @return bool |
||
46 | */ |
||
47 | View Code Duplication | public function isHiddenChildrenFromSitemap(NodeMenuItem $item) |
|
48 | { |
||
49 | if (is_subclass_of($item->getNode()->getRefEntityName(), 'Kunstmaan\\SitemapBundle\\Helper\\HiddenFromSitemapInterface')) { |
||
50 | $page = $item->getPage(); |
||
51 | |||
52 | return $page->isChildrenHiddenFromSitemap(); |
||
53 | } |
||
54 | |||
55 | return false; |
||
56 | } |
||
57 | } |
||
58 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.