Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
AppView
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 initialize
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare(strict_types=1);
3
4/**
5 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
6 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
7 *
8 * Licensed under The MIT License
9 * Redistributions of files must retain the above copyright notice.
10 *
11 * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
12 * @link      https://cakephp.org CakePHP(tm) Project
13 * @since     3.0.0
14 * @license   https://opensource.org/licenses/mit-license.php MIT License
15 */
16namespace AdminTheme\View;
17
18use Cake\View\View;
19
20/**
21 * Application View
22 *
23 * Your application's default view class
24 *
25 * @link https://book.cakephp.org/4/en/views.html#the-app-view
26 */
27class AppView extends View
28{
29    /**
30     * Initialization hook method.
31     *
32     * Use this method to add common initialization code like adding helpers.
33     *
34     * e.g. `$this->addHelper('Html');`
35     *
36     * @return void
37     */
38    public function initialize(): void
39    {
40        parent::initialize();
41
42        // Load shared gallery helper from main app
43        $this->addHelper('Gallery');
44
45        // Set Bootstrap-friendly form templates
46        $this->Form->setTemplates([
47            'inputContainer' => '<div class="{{type}}{{required}}">{{content}}</div>',
48            'inputContainerError' => '<div class="{{type}}{{required}} has-validation">{{content}}{{error}}</div>',
49            'error' => '<div class="invalid-feedback">{{content}}</div>',
50            'label' => '<label{{attrs}} class="form-label">{{text}}</label>',
51            'input' => '<input type="{{type}}" name="{{name}}" class="form-control {{attrs.class}}" {{attrs}}>',
52            'textarea' => '<textarea name="{{name}}" class="form-control {{attrs.class}}" {{attrs}}>{{value}}</textarea>',
53            'select' => '<select name="{{name}}" class="form-select {{attrs.class}}" {{attrs}}>{{content}}</select>',
54            'checkbox' => '<input type="checkbox" name="{{name}}" class="form-check-input {{attrs.class}}" {{attrs}}>',
55            'nestingLabel' => '{{hidden}}{{input}}<label{{attrs}} class="form-check-label">{{text}}</label>',
56            'radioContainer' => '<div class="form-check">{{content}}</div>',
57            'radio' => '<input type="radio" name="{{name}}" class="form-check-input"{{attrs}}>',
58            'formGroup' => '{{label}}{{input}}',
59            'inputGroupContainer' => '<div class="input-group {{type}}{{required}}">{{content}}</div>',
60            'inputGroupText' => '<span class="input-group-text">{{content}}</span>',
61            'inputGroupTextError' => '<span class="input-group-text">{{content}}</span>',
62        ]);
63    }
64}