1 | <?php |
||
23 | trait ElementListTrait |
||
24 | { |
||
25 | use ModifyElementQueryTrait, |
||
26 | NormalizeValueTrait, |
||
27 | InputTrait; |
||
28 | |||
29 | /** |
||
30 | * @var bool |
||
31 | */ |
||
32 | protected $ignoreSearchKeywords = true; |
||
33 | |||
34 | /** |
||
35 | * @inheritdoc |
||
36 | */ |
||
37 | public function getSearchKeywords($value, ElementInterface $element): string |
||
45 | |||
46 | /** |
||
47 | * Identify whether a sort order should be enforced. |
||
48 | * |
||
49 | * @return bool |
||
50 | */ |
||
51 | public function ensureSortOrder(): bool |
||
55 | |||
56 | /** |
||
57 | * Allow the settings to identify whether the element should be sortable |
||
58 | * |
||
59 | * @param bool $sortable |
||
60 | * @return $this |
||
61 | */ |
||
62 | public function setSortable(bool $sortable = null) |
||
67 | |||
68 | /** |
||
69 | * Get the sortable attribute value |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function getSortable(): bool |
||
77 | |||
78 | /** |
||
79 | * @inheritDoc |
||
80 | * @throws \Twig\Error\LoaderError |
||
81 | * @throws \Twig\Error\RuntimeError |
||
82 | * @throws \Twig\Error\SyntaxError |
||
83 | */ |
||
84 | public function getSettingsHtml() |
||
94 | |||
95 | /** |
||
96 | * Our value is not an ElementQueryInterface and therefore we should handle it |
||
97 | * differently. |
||
98 | * |
||
99 | * @inheritdoc |
||
100 | */ |
||
101 | public function afterElementSave(ElementInterface $element, bool $isNew) |
||
122 | } |
||
123 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: