-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.php
28 lines (21 loc) · 851 Bytes
/
Plugin.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
<?php
namespace EmbeddedEvents;
use MapasCulturais\App;
class Plugin extends \MapasCulturais\Plugin {
public function _init() {
$app = App::i();
$app->hook('GET(site.search):before', function() use($app){
$embedded = isset($this->data['embedded'] );
if($embedded){
$app->view->enqueueScript('app', 'embedded-events', 'js/embedded-events.js');
}
});
$app->hook('GET(site.embedded-events)', function() use ($app){
$url = $app->view->getSearchEventsUrl();
$url = str_replace('##', '?embedded##', $url);
$url = str_replace('filterEntity:event', 'filterEntity:event,viewMode:list', $url);
$app->redirect($url);
});
}
public function register() { }
}