]>
Commit | Line | Data |
---|---|---|
ba43064d A |
1 | <?php |
2 | ||
3 | declare(strict_types=1); | |
4 | ||
5 | namespace Shaarli\Front\Controller\Admin; | |
6 | ||
1a8ac737 | 7 | use Shaarli\Render\TemplatePage; |
ba43064d A |
8 | use Slim\Http\Request; |
9 | use Slim\Http\Response; | |
10 | ||
11 | /** | |
12 | * Class ToolsController | |
13 | * | |
14 | * Slim controller used to display the tools page. | |
15 | */ | |
16 | class ToolsController extends ShaarliAdminController | |
17 | { | |
18 | public function index(Request $request, Response $response): Response | |
19 | { | |
20 | $data = [ | |
21 | 'pageabsaddr' => index_url($this->container->environment), | |
22 | 'sslenabled' => is_https($this->container->environment), | |
23 | ]; | |
24 | ||
c22fa57a | 25 | $data = $this->executeHooks($data); |
ba43064d A |
26 | |
27 | foreach ($data as $key => $value) { | |
28 | $this->assignView($key, $value); | |
29 | } | |
30 | ||
31 | $this->assignView('pagetitle', t('Tools') .' - '. $this->container->conf->get('general.title', 'Shaarli')); | |
32 | ||
1a8ac737 | 33 | return $response->write($this->render(TemplatePage::TOOLS)); |
ba43064d A |
34 | } |
35 | ||
36 | /** | |
37 | * @param mixed[] $data Variables passed to the template engine | |
38 | * | |
39 | * @return mixed[] Template data after active plugins render_picwall hook execution. | |
40 | */ | |
41 | protected function executeHooks(array $data): array | |
42 | { | |
43 | $this->container->pluginManager->executeHooks( | |
44 | 'render_tools', | |
45 | $data | |
46 | ); | |
47 | ||
48 | return $data; | |
49 | } | |
50 | } |