/
BackendCustom.php
64 lines (52 loc) · 1.08 KB
/
BackendCustom.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2016 Leo Feyer
*
* @license LGPL-3.0+
*/
namespace Contao;
/**
* Back end custom controller.
*
* @author Jim Schmid <https://github.com/sheeep>
*/
class BackendCustom extends BackendMain
{
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
// Initialize the template in the constructor so it is available in the getTemplateObject() method
$this->Template = new \BackendTemplate('be_main');
}
/**
* Return the template object
*
* @return BackendTemplate|object
*/
public function getTemplateObject()
{
return $this->Template;
}
/**
* Run the controller and parse the template
*
* @return Response
*/
public function run()
{
$packages = $this->getContainer()->getParameter('kernel.packages');
$this->Template->version = $packages['contao/core-bundle'];
// Ajax request
if ($_POST && \Environment::get('isAjaxRequest'))
{
$this->objAjax = new \Ajax(\Input::post('action'));
$this->objAjax->executePreActions();
}
return $this->output();
}
}