-
Notifications
You must be signed in to change notification settings - Fork 177
/
Copy pathGeneralController.php
70 lines (56 loc) · 2.29 KB
/
GeneralController.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
65
66
67
68
69
70
<?php
declare(strict_types=1);
namespace Bolt\Controller\Backend;
use Bolt\Configuration\Config;
use Bolt\Controller\TwigAwareController;
use Bolt\Entity\Content;
use Bolt\Repository\ContentRepository;
use Bolt\Version;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class GeneralController extends TwigAwareController implements BackendZoneInterface
{
/** @var \Bolt\Doctrine\Version */
private $doctrineVersion;
public function __construct(\Bolt\Doctrine\Version $doctrineVersion)
{
$this->doctrineVersion = $doctrineVersion;
}
/**
* @Route("/about", name="bolt_about")
*/
public function about(): Response
{
$this->denyAccessUnlessGranted('about');
$twigVars = [
'installType' => Version::installType(),
'platform' => $this->doctrineVersion->getPlatform(),
'php' => PHP_VERSION,
'symfony' => Version::getSymfonyVersion(),
'os_name' => php_uname('s'),
'os_version' => php_uname('r'),
'memory_limit' => ini_get('memory_limit'),
];
return $this->render('@bolt/pages/about.html.twig', $twigVars);
}
/**
* @Route("/kitchensink", name="bolt_kitchensink")
*/
public function kitchensink(ContentRepository $content, Config $config): Response
{
$this->denyAccessUnlessGranted('kitchensink');
$contentTypes = $config->get('contenttypes');
/** @var Content $records */
$records = $content->findLatest($contentTypes, 1, 4);
$this->addFlash('success', '<strong>Well done!</strong> You successfully read this important alert message.');
$this->addFlash('info', '<strong>Heads up!</strong> This alert needs your attention, but it\'s not super important.');
$this->addFlash('warning', '<strong>Warning!</strong> Better check yourself, you\'re not looking too good.');
$this->addFlash('danger', '<strong>Oh snap!</strong> Change a few things up and try submitting again.');
$twigVars = [
'title' => 'Kitchensink',
'subtitle' => 'To show a number of different things, on one page',
'records' => $records,
];
return $this->render('@bolt/pages/kitchensink.html.twig', $twigVars);
}
}