AddEventTicketsToDonationConfirmationPageDonationTotal.php
2 years ago
AddEventTicketsToDonationConfirmationPageEventTicketDetails.php
2 years ago
AttachAttendeeDataToTicketData.php
2 years ago
ConvertEventTicketsBlockToFieldsApi.php
2 years ago
EnqueueDonationFormScripts.php
2 years ago
EnqueueEventDetailsScripts.php
2 years ago
EnqueueFormBuilderScripts.php
2 years ago
EnqueueListTableScripts.php
2 years ago
GenerateTicketsFromPurchaseData.php
2 years ago
RegisterEventsMenuItem.php
2 years ago
RenderDonationFormBlock.php
2 years ago
UpdateDonationConfirmationPageReceiptDonationAmount.php
2 years ago
RegisterEventsMenuItem.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\EventTickets\Actions; |
| 4 | |
| 5 | use Give\EventTickets\Models\Event; |
| 6 | |
| 7 | /** |
| 8 | * @since 3.6.0 |
| 9 | */ |
| 10 | class RegisterEventsMenuItem |
| 11 | { |
| 12 | public function __invoke() |
| 13 | { |
| 14 | add_submenu_page( |
| 15 | 'edit.php?post_type=give_forms', |
| 16 | esc_html__('Events', 'give'), |
| 17 | esc_html__('Events', 'give') . ' <span class="update-plugins">BETA</span>', |
| 18 | 'edit_give_forms', |
| 19 | 'give-event-tickets', |
| 20 | [$this, 'render'] |
| 21 | ); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Render admin page container |
| 26 | * |
| 27 | * @since 3.6.0 |
| 28 | */ |
| 29 | public function render() |
| 30 | { |
| 31 | if(isset($_GET['id'])) { |
| 32 | $event = Event::find(absint($_GET['id'])); |
| 33 | |
| 34 | if (!$event) { |
| 35 | wp_die(__('Event not found', 'give-event-tickets'), 404); |
| 36 | } |
| 37 | |
| 38 | give(EnqueueEventDetailsScripts::class)($event); |
| 39 | } else { |
| 40 | give(EnqueueListTableScripts::class)(); |
| 41 | } |
| 42 | |
| 43 | echo '<div id="give-admin-event-tickets-root"></div>'; |
| 44 | } |
| 45 | } |
| 46 |