|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of EC-CUBE |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved. |
|
7
|
|
|
* |
|
8
|
|
|
* http://www.lockon.co.jp/ |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Eccube\Controller\Block; |
|
15
|
|
|
|
|
16
|
|
|
use Eccube\Controller\AbstractController; |
|
17
|
|
|
use Eccube\Event\EccubeEvents; |
|
18
|
|
|
use Eccube\Event\EventArgs; |
|
19
|
|
|
use Eccube\Form\Type\SearchProductBlockType; |
|
20
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
|
21
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
|
22
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
23
|
|
|
use Symfony\Component\HttpFoundation\RequestStack; |
|
24
|
|
|
|
|
25
|
|
|
class SearchProductController extends AbstractController |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* @var RequestStack |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $requestStack; |
|
31
|
|
|
|
|
32
|
117 |
|
public function __construct(RequestStack $requestStack |
|
33
|
|
|
) { |
|
34
|
117 |
|
$this->requestStack = $requestStack; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @Route("/block/search_product", name="block_search_product") |
|
39
|
|
|
* @Template("Block/search_product.twig") |
|
40
|
|
|
*/ |
|
41
|
117 |
|
public function index(Request $request) |
|
42
|
|
|
{ |
|
43
|
117 |
|
$builder = $this->formFactory |
|
44
|
117 |
|
->createNamedBuilder('', SearchProductBlockType::class) |
|
45
|
117 |
|
->setMethod('GET'); |
|
46
|
|
|
|
|
47
|
117 |
|
$event = new EventArgs( |
|
48
|
|
|
[ |
|
49
|
117 |
|
'builder' => $builder, |
|
50
|
|
|
], |
|
51
|
117 |
|
$request |
|
52
|
|
|
); |
|
53
|
|
|
|
|
54
|
117 |
|
$this->eventDispatcher->dispatch(EccubeEvents::FRONT_BLOCK_SEARCH_PRODUCT_INDEX_INITIALIZE, $event); |
|
55
|
|
|
|
|
56
|
117 |
|
$request = $this->requestStack->getMasterRequest(); |
|
57
|
|
|
|
|
58
|
117 |
|
$form = $builder->getForm(); |
|
59
|
117 |
|
$form->handleRequest($request); |
|
60
|
|
|
|
|
61
|
|
|
return [ |
|
62
|
117 |
|
'form' => $form->createView(), |
|
63
|
|
|
]; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|