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