Checks file comment copyright tag order
1 | <?php |
||
2 | /** |
||
3 | * Template Comments plugin for Craft CMS |
||
4 | * |
||
5 | * Adds a HTML comment to demarcate each Twig template that is included or extended. |
||
6 | * |
||
7 | * @link https://nystudio107.com/ |
||
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
8 | * @copyright Copyright (c) nystudio107 |
||
9 | */ |
||
10 | |||
11 | namespace nystudio107\templatecomments\models; |
||
12 | |||
13 | use craft\base\Model; |
||
14 | use craft\validators\ArrayValidator; |
||
15 | |||
16 | /** |
||
17 | * @author nystudio107 |
||
18 | * @package TemplateComments |
||
19 | * @since 1.0.0 |
||
20 | */ |
||
21 | class Settings extends Model |
||
22 | { |
||
23 | // Public Properties |
||
24 | // ========================================================================= |
||
25 | |||
26 | /** |
||
27 | * @var bool Whether comments should be generated for site templates |
||
28 | */ |
||
29 | public bool $siteTemplateComments = true; |
||
30 | |||
31 | /** |
||
32 | * @var bool Whether comments should be generated for Control Panel templates |
||
33 | */ |
||
34 | public bool $cpTemplateComments = false; |
||
35 | |||
36 | /** |
||
37 | * @var bool Whether to generate comments only when `devMode` is on |
||
38 | */ |
||
39 | public bool $onlyCommentsInDevMode = true; |
||
40 | |||
41 | /** |
||
42 | * @var array Don't add comments to template blocks that contain these strings (case-insensitive) |
||
43 | */ |
||
44 | public array $excludeBlocksThatContain = [ |
||
45 | 'css', |
||
46 | 'js', |
||
47 | 'javascript', |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * @var bool Whether or not to show comments for templates that are include'd |
||
52 | */ |
||
53 | public bool $templateCommentsEnabled = true; |
||
54 | |||
55 | /** |
||
56 | * @var bool Whether or not to show comments for `{% block %}`s |
||
57 | */ |
||
58 | public bool $blockCommentsEnabled = true; |
||
59 | |||
60 | /** |
||
61 | * @var array Template file suffixes that Template Comments should be enabled for |
||
62 | */ |
||
63 | public array $allowedTemplateSuffixes = [ |
||
64 | '', |
||
65 | 'twig', |
||
66 | 'htm', |
||
67 | 'html', |
||
68 | ]; |
||
69 | |||
70 | // Public Methods |
||
71 | // ========================================================================= |
||
72 | /** |
||
73 | * @inerhitdoc |
||
74 | */ |
||
75 | public function rules(): array |
||
76 | { |
||
77 | return [ |
||
78 | [ |
||
79 | [ |
||
80 | 'siteTemplateComments', |
||
81 | 'cpTemplateComments', |
||
82 | 'onlyCommentsInDevMode', |
||
83 | 'templateCommentsEnabled', |
||
84 | 'blockCommentsEnabled', |
||
85 | ], |
||
86 | 'boolean', |
||
87 | ], |
||
88 | [ |
||
89 | [ |
||
90 | 'excludeBlocksThatContain', |
||
91 | 'allowedTemplateSuffixes', |
||
92 | ], |
||
93 | ArrayValidator::class, |
||
94 | ], |
||
95 | ]; |
||
96 | } |
||
97 | } |
||
98 |