AmeliaBookingButtonRendererTrait.php
2 months ago
AmeliaBookingModule.php
7 months ago
AmeliaCatalogBookingModule.php
1 month ago
AmeliaCatalogModule.php
7 months ago
AmeliaCustomerPanelModule.php
7 months ago
AmeliaEmployeePanelModule.php
7 months ago
AmeliaEventsCalendarModule.php
1 month ago
AmeliaEventsListBookingButtonModule.php
2 months ago
AmeliaEventsListModule.php
1 month ago
AmeliaEventsModule.php
7 months ago
AmeliaSearchModule.php
7 months ago
AmeliaStepBookingButtonModule.php
2 months ago
AmeliaStepBookingModule.php
1 month ago
ModuleMetadata.php
1 month ago
SharedShortcodeModule.php
1 month ago
index.php
1 month ago
SharedShortcodeModule.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Divi5Amelia; |
| 4 | |
| 5 | use ET\Builder\Framework\DependencyManagement\Interfaces\DependencyInterface; |
| 6 | |
| 7 | /** |
| 8 | * Class that handle shared booking module output in frontend. |
| 9 | */ |
| 10 | abstract class SharedShortcodeModule implements DependencyInterface |
| 11 | { |
| 12 | /** |
| 13 | * Get shared shortcode string from attributes. |
| 14 | * |
| 15 | * @param array $attrs Attributes array. |
| 16 | * @return string Shared shortcode string. |
| 17 | */ |
| 18 | public static function getSharedShortcodeString($attrs) |
| 19 | { |
| 20 | $shortcode = ''; |
| 21 | |
| 22 | // Trigger |
| 23 | $trigger = $attrs['trigger']['innerContent']['desktop']['value'] ?? null; |
| 24 | if ($trigger !== null && $trigger !== '') { |
| 25 | $shortcode .= ' trigger=' . esc_attr($trigger); |
| 26 | } |
| 27 | |
| 28 | // Trigger Type |
| 29 | $trigger_type = $attrs['trigger_type']['innerContent']['desktop']['value'] ?? null; |
| 30 | if ($trigger && $trigger_type !== null && $trigger_type !== '') { |
| 31 | $shortcode .= ' trigger_type=' . esc_attr($trigger_type); |
| 32 | } |
| 33 | |
| 34 | // In Dialog |
| 35 | $in_dialog = $attrs['in_dialog']['innerContent']['desktop']['value'] ?? false; |
| 36 | if ($in_dialog === 'on') { |
| 37 | $shortcode .= ' in_dialog=1'; |
| 38 | } |
| 39 | |
| 40 | // Ivy |
| 41 | $ivy = $attrs['ivy']['innerContent']['desktop']['value'] ?? null; |
| 42 | if ($ivy !== null && $ivy !== '' && !$trigger) { |
| 43 | $shortcode .= ' ivy=' . esc_attr($ivy); |
| 44 | } |
| 45 | |
| 46 | return $shortcode; |
| 47 | } |
| 48 | } |
| 49 |