1 | <?php |
||
2 | |||
3 | /* |
||
4 | * @copyright 2014 Mautic Contributors. All rights reserved |
||
5 | * @author Mautic |
||
6 | * |
||
7 | * @link http://mautic.org |
||
8 | * |
||
9 | * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html |
||
10 | */ |
||
11 | |||
12 | namespace Mautic\CategoryBundle\Controller; |
||
13 | |||
14 | use Mautic\CoreBundle\Controller\AjaxController as CommonAjaxController; |
||
15 | use Mautic\CoreBundle\Helper\InputHelper; |
||
16 | use Symfony\Component\HttpFoundation\Request; |
||
17 | |||
18 | /** |
||
19 | * Class AjaxController. |
||
20 | */ |
||
21 | class AjaxController extends CommonAjaxController |
||
22 | { |
||
23 | /** |
||
24 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
||
25 | */ |
||
26 | protected function categoryListAction(Request $request) |
||
27 | { |
||
28 | $bundle = InputHelper::clean($request->query->get('bundle')); |
||
29 | $filter = InputHelper::clean($request->query->get('filter')); |
||
30 | $results = $this->getModel('category')->getLookupResults($bundle, $filter, 10); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
31 | $dataArray = []; |
||
32 | foreach ($results as $r) { |
||
33 | $dataArray[] = [ |
||
34 | 'label' => $r['title']." ({$r['id']})", |
||
35 | 'value' => $r['id'], |
||
36 | ]; |
||
37 | } |
||
38 | |||
39 | return $this->sendJsonResponse($dataArray); |
||
40 | } |
||
41 | } |
||
42 |