1 | <?php |
||
23 | class PostingBehavior extends Behavior |
||
24 | { |
||
25 | /** @var CurrentUserInterface */ |
||
26 | private $CurrentUser; |
||
27 | |||
28 | /** @var FieldFilter */ |
||
29 | private $fieldFilter; |
||
30 | |||
31 | /** |
||
32 | * {@inheritDoc} |
||
33 | */ |
||
34 | public function initialize(array $config) |
||
40 | |||
41 | /** |
||
42 | * Creates a new posting from user |
||
43 | * |
||
44 | * @param array $data raw posting data |
||
45 | * @param CurrentUserInterface $CurrentUser the current user |
||
46 | * @return Entry|null on success, null otherwise |
||
47 | */ |
||
48 | public function createPosting(array $data, CurrentUserInterface $CurrentUser): ?Entry |
||
87 | |||
88 | /** |
||
89 | * Updates an existing posting |
||
90 | * |
||
91 | * @param Entry $posting the posting to update |
||
92 | * @param array $data data the posting should be updated with |
||
93 | * @param CurrentUserInterface $CurrentUser the current-user |
||
94 | * @return Entry the posting which was asked to update |
||
95 | */ |
||
96 | public function updatePosting(Entry $posting, array $data, CurrentUserInterface $CurrentUser): Entry |
||
125 | |||
126 | /** |
||
127 | * Populates data of an answer derived from parent the parent-posting |
||
128 | * |
||
129 | * @param BasicPostingInterface $parent parent data |
||
130 | * @param array $data current posting data |
||
131 | * @return array populated $data |
||
132 | */ |
||
133 | public function prepareChildPosting(BasicPostingInterface $parent, array $data): array |
||
145 | |||
146 | /** |
||
147 | * Sets-up validator for the table |
||
148 | * |
||
149 | * @param CurrentUserInterface $CurrentUser current user |
||
150 | * @return void |
||
151 | */ |
||
152 | private function validatorSetup(CurrentUserInterface $CurrentUser): void |
||
162 | |||
163 | /** |
||
164 | * check that entries are only in existing and allowed categories |
||
165 | * |
||
166 | * @param mixed $categoryId value |
||
167 | * @param array $context context |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function validateCategoryIsAllowed($categoryId, $context): bool |
||
178 | |||
179 | /** |
||
180 | * check editing allowed |
||
181 | * |
||
182 | * @param mixed $check value |
||
183 | * @param array $context context |
||
184 | * @return bool |
||
185 | */ |
||
186 | public function validateEditingAllowed($check, $context): bool |
||
192 | } |
||
193 |