1 | <?php |
||
2 | /** |
||
3 | * Twigfield for Craft CMS |
||
4 | * |
||
5 | * Provides a twig editor field with Twig & Craft API autocomplete |
||
6 | * |
||
7 | * @link https://nystudio107.com |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
8 | * @copyright Copyright (c) 2022 nystudio107 |
||
0 ignored issues
–
show
|
|||
9 | */ |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | namespace nystudio107\twigfield\models; |
||
12 | |||
13 | use craft\base\Model; |
||
14 | use craft\validators\ArrayValidator; |
||
15 | use nystudio107\twigfield\autocompletes\CraftApiAutocomplete; |
||
16 | use nystudio107\twigfield\autocompletes\SectionShorthandFieldsAutocomplete; |
||
17 | use nystudio107\twigfield\autocompletes\TwigLanguageAutocomplete; |
||
18 | |||
19 | /** |
||
0 ignored issues
–
show
|
|||
20 | * @author nystudio107 |
||
0 ignored issues
–
show
Content of the @author tag must be in the form "Display Name <[email protected]>"
![]() |
|||
21 | * @package Twigfield |
||
0 ignored issues
–
show
|
|||
22 | * @since 1.0.0 |
||
0 ignored issues
–
show
|
|||
23 | */ |
||
0 ignored issues
–
show
|
|||
24 | class Settings extends Model |
||
25 | { |
||
26 | // Public Properties |
||
27 | // ========================================================================= |
||
28 | |||
29 | /** |
||
0 ignored issues
–
show
|
|||
30 | * @var bool Whether to allow anonymous access be allowed to the twigfield/autocomplete/index endpoint |
||
31 | */ |
||
32 | public $allowFrontendAccess = false; |
||
33 | |||
34 | /** |
||
0 ignored issues
–
show
|
|||
35 | * @var string[] The default autcompletes to use for the default `Twigfield` field type |
||
36 | */ |
||
37 | public $defaultTwigfieldAutocompletes = [ |
||
38 | CraftApiAutocomplete::class, |
||
39 | TwigLanguageAutocomplete::class, |
||
40 | SectionShorthandFieldsAutocomplete::class, |
||
41 | ]; |
||
42 | |||
43 | // Public Methods |
||
44 | // ========================================================================= |
||
45 | |||
46 | /** |
||
0 ignored issues
–
show
|
|||
47 | * @inheritdoc |
||
48 | */ |
||
0 ignored issues
–
show
|
|||
49 | public function defineRules(): array |
||
50 | { |
||
51 | return [ |
||
52 | ['allowFrontendAccess', 'boolean'], |
||
53 | ['defaultTwigfieldAutocompletes', ArrayValidator::class], |
||
54 | ]; |
||
55 | } |
||
56 | } |
||
57 |