PluginProbe
The Innovative Form Builder – IvyForms / 1.5.1
The Innovative Form Builder – IvyForms v1.5.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
← All changes | backend/src/Entity/Confirmation/Confirmation.php +93 -5 0.7 → 1.5.1 View file →
@@ -1,14 +1,10 @@
1 1 <?php
2 2
3 3 namespace IvyForms\Entity\Confirmation;
4 4
5 -// phpcs:disable PSR1.Files.SideEffects
6 -if (!defined('ABSPATH')) {
7 - exit; // Exit if accessed directly
8 -}
9 -
10 5 use IvyForms\ValueObjects\Confirmation\Confirmation as ConfirmationValueObject;
6 +use IvyForms\Common\Helpers\Helper;
11 7
12 8 /**
13 9 * Class Confirmation
14 10 *
@@ -191,8 +187,94 @@
191 187 $this->confirmation->page = $page;
192 188 }
193 189
194 190 /**
191 + * Get the confirmation name.
192 + *
193 + * @return string
194 + */
195 + public function getName(): string
196 + {
197 + return $this->confirmation->getName();
198 + }
199 +
200 + /**
201 + * Set the confirmation name.
202 + *
203 + * @param string $name
204 + */
205 + public function setName(string $name): void
206 + {
207 + $this->confirmation->name = $name;
208 + }
209 +
210 + /**
211 + * Get the confirmation list position.
212 + *
213 + * @return int
214 + */
215 + public function getPosition(): int
216 + {
217 + return $this->confirmation->getPosition();
218 + }
219 +
220 + /**
221 + * Set the confirmation list position.
222 + *
223 + * @param int $position
224 + */
225 + public function setPosition(int $position): void
226 + {
227 + $this->confirmation->position = $position;
228 + }
229 +
230 + /**
231 + * Whether this confirmation is the default for the form.
232 + *
233 + * @return bool
234 + */
235 + public function isDefault(): bool
236 + {
237 + return $this->confirmation->isDefault();
238 + }
239 +
240 + /**
241 + * Set whether this confirmation is the default for the form.
242 + *
243 + * @param bool $isDefault
244 + */
245 + public function setIsDefault(bool $isDefault): void
246 + {
247 + $this->confirmation->isDefault = $isDefault;
248 + }
249 +
250 + /**
251 + * @return array<string, mixed>
252 + */
253 + public function getSmartLogic(): array
254 + {
255 + return $this->confirmation->getSmartLogic();
256 + }
257 +
258 + /**
259 + * @param array<string, mixed> $smartLogic
260 + */
261 + public function setSmartLogic(array $smartLogic): void
262 + {
263 + $this->confirmation->smartLogic = $smartLogic;
264 + }
265 +
266 + /**
267 + * Get the page URL converted from page ID.
268 + *
269 + * @return string The page URL, empty string if page is not set or not found.
270 + */
271 + public function getPageUrl(): string
272 + {
273 + return Helper::getPageUrlFromId($this->getPage());
274 + }
275 +
276 + /**
195 277 * Convert the confirmation entity to an array.
196 278 *
197 279 * @return array<string, mixed> The confirmation entity as an array.
198 280 */
@@ -200,13 +282,19 @@
200 282 {
201 283 return [
202 284 'id' => $this->getId(),
203 285 'formId' => $this->getFormId(),
286 + 'name' => $this->getName(),
204 287 'type' => $this->getType(),
205 288 'enabled' => $this->isEnabled(),
206 289 'showForm' => $this->isShowForm(),
207 290 'message' => $this->getMessage(),
208 291 'url' => $this->getUrl(),
292 + //TODO : Check if page is needed as we have pageUrl
209 293 'page' => $this->getPage(),
294 + 'pageUrl' => $this->getPageUrl(),
295 + 'position' => $this->getPosition(),
296 + 'isDefault' => $this->isDefault(),
297 + 'smartLogic' => $this->getSmartLogic(),
210 298 ];
211 299 }
212 300 }