PluginProbe
Pods – Custom Content Types and Fields / 2.8.23.5
Pods – Custom Content Types and Fields v2.8.23.5
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 All 42 releases
pods / tribe-common / src / Tribe / Service_Providers / Dialog.php
Dialog.php
111 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Tribe\Service_Providers;
4
5 /**
6 * Class Dialog
7 *
8 * @since 4.10.0
9 *
10 * Handles the registration and creation of our async process handlers.
11 */
12 class Dialog extends \tad_DI52_ServiceProvider {
13
14 /**
15 * Binds and sets up implementations.
16 *
17 * @since 4.10.0
18 */
19 public function register() {
20 tribe_singleton( 'dialog.view', '\Tribe\Dialog\View' );
21
22 /**
23 * Allows plugins to hook into the register action to register views, etc
24 *
25 * @since 4.10.0
26 *
27 * @param Tribe\Service_Providers\Dialog $dialog
28 */
29 do_action( 'tribe_dialog_register', $this );
30
31 $this->hooks();
32 }
33
34 /**
35 * Set up hooks for classes.
36 *
37 * @since 4.10.0
38 */
39 private function hooks() {
40 add_action( 'tribe_common_loaded', [ $this, 'register_dialog_assets' ] );
41 add_filter( 'tribe_template_public_namespace', [ $this, 'template_public_namespace' ], 10, 2 );
42
43 /**
44 * Allows plugins to hook into the hooks action to register their own hooks
45 *
46 * @since 4.10.0
47 *
48 * @param Tribe\Service_Providers\Dialog $dialog
49 */
50 do_action( 'tribe_dialog_hooks', $this );
51 }
52
53 /**
54 * {@inheritdoc}
55 *
56 * @since 4.10.0
57 */
58 public function template_public_namespace( $namespace, $obj ) {
59 if ( ! empty( $obj->template_namespace ) && 'dialog' === $obj->template_namespace ) {
60 array_push( $namespace, 'dialog' );
61 }
62
63 return $namespace;
64 }
65
66 /**
67 * Register assets associated with dialog
68 *
69 * @since 4.10.0
70 */
71 public function register_dialog_assets() {
72 $main = \Tribe__Main::instance();
73
74 tribe_asset(
75 $main,
76 'tribe-dialog',
77 'dialog.css',
78 [],
79 [],
80 [ 'groups' => 'tribe-dialog' ]
81 );
82
83 tribe_asset(
84 $main,
85 'mt-a11y-dialog',
86 'node_modules/mt-a11y-dialog/a11y-dialog.js',
87 [ 'underscore', 'tribe-common' ],
88 [],
89 [ 'groups' => 'tribe-dialog' ]
90 );
91
92 tribe_asset(
93 $main,
94 'tribe-dialog-js',
95 'dialog.js',
96 [ 'mt-a11y-dialog' ],
97 [],
98 [ 'groups' => 'tribe-dialog' ]
99 );
100
101 /**
102 * Allows plugins to hook into the assets action to register their own assets
103 *
104 * @since 4.10.0
105 *
106 * @param Tribe\Service_Providers\Dialog $dialog
107 */
108 do_action( 'tribe_dialog_assets_registered', $this );
109 }
110 }
111