This repository has been archived by the owner on Mar 9, 2021. It is now read-only.
forked from flix-tech/MFBCmsBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMFBCmsBundle.php
71 lines (65 loc) · 2.52 KB
/
MFBCmsBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace MFB\CmsBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* @category MFB
* @package MFBCmsBundle
* @author Eric Reiche <[email protected]>
* @author MFB MeinFernbus GmbH <[email protected]>
* @copyright 2012 MFB MeinFernbus GmbH
* @license http://opensource.org/licenses/MIT The MIT License (MIT)
* @link https://github.com/meinfernbusde/MFBCmsBundle
*/
class MFBCmsBundle extends Bundle
{
/**
* Presta sitemap bundle integration
*/
public function boot()
{
/**
* @var mixed $router
* @var mixed $event
*/
$router = $this->container->get('router');
$event = $this->container->get('event_dispatcher');
if (class_exists('\Presta\SitemapBundle\PrestaSitemapBundle')) {
//listen presta_sitemap.populate event
$event->addListener(
\Presta\SitemapBundle\Event\SitemapPopulateEvent::onSitemapPopulate,
function (\Presta\SitemapBundle\Event\SitemapPopulateEvent $event) use ($router) {
// get absolute url
$url = $router->generate('pressrelease_list', array(), true);
// add url to the url-set
$event->getGenerator()->addUrl(
new \Presta\SitemapBundle\Sitemap\Url\UrlConcrete (
$url,
null,
\Presta\SitemapBundle\Sitemap\Url\UrlConcrete::CHANGEFREQ_WEEKLY,
1
),
'content'
);
}
);
//listen presta_sitemap.populate event
$event->addListener(
\Presta\SitemapBundle\Event\SitemapPopulateEvent::onSitemapPopulate,
function (\Presta\SitemapBundle\Event\SitemapPopulateEvent $event) use ($router) {
// get absolute url
$url = $router->generate('pressrelease_current', array(), true);
// add url to the url-set
$event->getGenerator()->addUrl(
new \Presta\SitemapBundle\Sitemap\Url\UrlConcrete (
$url,
null,
\Presta\SitemapBundle\Sitemap\Url\UrlConcrete::CHANGEFREQ_WEEKLY,
1
),
'content'
);
}
);
}
}
}