Blame view

src/View/AjaxView.php 1.49 KB
6c4edfa3   Alexandre   First Commit LabI...
1
2
<?php
/**
a7b160e5   Etienne Pallier   Mise en conformit...
3
4
 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
6c4edfa3   Alexandre   First Commit LabI...
5
6
7
8
9
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
a7b160e5   Etienne Pallier   Mise en conformit...
10
11
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 * @link          https://cakephp.org CakePHP(tm) Project
6c4edfa3   Alexandre   First Commit LabI...
12
 * @since         3.0.4
a7b160e5   Etienne Pallier   Mise en conformit...
13
 * @license       https://opensource.org/licenses/mit-license.php MIT License
6c4edfa3   Alexandre   First Commit LabI...
14
15
16
 */
namespace App\View;

a7b160e5   Etienne Pallier   Mise en conformit...
17
18
19
20
21
// NEW in CAKEPHP3.10
use Cake\Event\EventManager;
use Cake\Http\Response;
use Cake\Http\ServerRequest;

6c4edfa3   Alexandre   First Commit LabI...
22
23
24
25
26
27
28
29
30
/**
 * A view class that is used for AJAX responses.
 * Currently only switches the default layout and sets the response type -
 * which just maps to text/html by default.
 */
class AjaxView extends AppView
{

    /**
63c3cb16   epallier   Nombreux petits b...
31
     * The name of the layout file to render the view inside of.
a7b160e5   Etienne Pallier   Mise en conformit...
32
33
     * The name specified is the filename of the layout in /src/Template/Layout 
	 * without the .ctp extension.
6c4edfa3   Alexandre   First Commit LabI...
34
35
36
37
38
39
40
41
42
43
44
45
46
     *
     * @var string
     */
    public $layout = 'ajax';

    /**
     * Initialization hook method.
     *
     * @return void
     */
    public function initialize()
    {
        parent::initialize();
63c3cb16   epallier   Nombreux petits b...
47
        
521ce3e5   Etienne Pallier   05/10/2020 v4.104...
48
        //$this->response->type('ajax');
a7b160e5   Etienne Pallier   Mise en conformit...
49
50
51
52
53
        // 3.7
        //$this->response->withType('ajax');
        // 3.10
        $this->response = $this->response->withType('ajax');
        
6c4edfa3   Alexandre   First Commit LabI...
54
55
    }
}