Connection_Resolver
3 years ago
Connection.php
3 years ago
Field.php
3 years ago
Integration.php
3 years ago
Service_Provider.php
3 years ago
Settings.php
3 years ago
Service_Provider.php
53 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Pods\Integrations\WPGraphQL; |
| 4 | |
| 5 | /** |
| 6 | * Class Service_Provider |
| 7 | * |
| 8 | * @since 2.9.0 |
| 9 | */ |
| 10 | class Service_Provider extends \Pods\Service_Provider_Base { |
| 11 | |
| 12 | /** |
| 13 | * Registers the classes and functionality needed. |
| 14 | * |
| 15 | * @since 2.9.0 |
| 16 | */ |
| 17 | public function register() { |
| 18 | $this->container->singleton( Integration::class, Integration::class ); |
| 19 | $this->container->singleton( Settings::class, Settings::class ); |
| 20 | |
| 21 | $this->hooks(); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Hooks all the methods and actions the class needs. |
| 26 | * |
| 27 | * @since 2.9.0 |
| 28 | */ |
| 29 | protected function hooks() { |
| 30 | add_action( 'init', [ $this, 'hook_init' ] ); |
| 31 | } |
| 32 | |
| 33 | public function hook_init() { |
| 34 | $integration = pods_container( Integration::class ); |
| 35 | |
| 36 | $requirements = $integration->get_requirements(); |
| 37 | |
| 38 | $pods_admin = pods_admin(); |
| 39 | |
| 40 | // Only hook into the integration if the requirements are met. |
| 41 | if ( ! $pods_admin->check_requirements( $requirements ) ) { |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | $integration->hook(); |
| 46 | |
| 47 | // Get the Settings instance and register the settings. |
| 48 | $settings = pods_container( Settings::class ); |
| 49 | |
| 50 | $settings->hook(); |
| 51 | } |
| 52 | } |
| 53 |