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