PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / EventTickets / Actions / RegisterEventsMenuItem.php

RegisterEventsMenuItem.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/EventTickets/Actions/RegisterEventsMenuItem.php

48 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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