PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / trunk
Pods – Custom Content Types and Fields vtrunk
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 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / src / Pods / Integrations / WPGraphQL / Service_Provider.php
pods / src / Pods / Integrations / WPGraphQL Last commit date
Connection_Resolver 4 months ago Connection.php 4 months ago Field.php 4 months ago Integration.php 4 months ago Service_Provider.php 4 months ago Settings.php 4 months ago
Service_Provider.php
58 lines
1 <?php
2
3 namespace Pods\Integrations\WPGraphQL;
4
5 // Don't load directly.
6 if ( ! defined( 'ABSPATH' ) ) {
7 die( '-1' );
8 }
9
10 /**
11 * Class Service_Provider
12 *
13 * @since 2.9.0
14 */
15 class Service_Provider extends \Pods\Service_Provider_Base {
16
17 /**
18 * Registers the classes and functionality needed.
19 *
20 * @since 2.9.0
21 */
22 public function register() {
23 $this->container->singleton( Integration::class, Integration::class );
24 $this->container->singleton( Settings::class, Settings::class );
25
26 $this->hooks();
27 }
28
29 /**
30 * Hooks all the methods and actions the class needs.
31 *
32 * @since 2.9.0
33 */
34 protected function hooks() {
35 add_action( 'init', [ $this, 'hook_init' ] );
36 }
37
38 public function hook_init() {
39 $integration = pods_container( Integration::class );
40
41 $requirements = $integration->get_requirements();
42
43 $pods_admin = pods_admin();
44
45 // Only hook into the integration if the requirements are met.
46 if ( ! $pods_admin->check_requirements( $requirements ) ) {
47 return;
48 }
49
50 $integration->hook();
51
52 // Get the Settings instance and register the settings.
53 $settings = pods_container( Settings::class );
54
55 $settings->hook();
56 }
57 }
58