-
Notifications
You must be signed in to change notification settings - Fork 1
/
RiAskAQuestion.php
37 lines (28 loc) · 1.3 KB
/
RiAskAQuestion.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
<?php
namespace plugins\riAskAQuestion;
use plugins\riCore\Plugin;
class RiAskAQuestion extends Plugin{
public function init(){
$container = $this->container;
$request = $container->getParameter('request');
$objects_id = 0;
$type = 'categories';
if($request->get('products_id') != null) {
$type = 'products';
$objects_id = $request->get('products_id');
}
elseif($request->get('cPath') != null) {
$objects_id = end(explode('_' , $request->get('cPath')));
}
$parse_view = function ($event) use ($container, $type, $objects_id){
$container->get('riCore.HolderHelper')->add($event->getSlot(), $container->get('riCore.View')->render('riAskAQuestion::_frontend_link.php', array(
'type' => $type,
'objects_id' => $objects_id
)));
};
// add listener to index_categories_top holder
$this->dispatcher->addListener('view.helper.holder.get.start.index_categories_top', $parse_view);
$this->dispatcher->addListener('view.helper.holder.get.start.index_product_list_top', $parse_view);
$this->dispatcher->addListener('view.helper.holder.get.start.index_product_top', $parse_view);
}
}