-
Notifications
You must be signed in to change notification settings - Fork 1
/
MFBCmsBundle.php
62 lines (56 loc) · 2 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
<?php
namespace MFB\CmsBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
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');
//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'
);
}
);
}
}