Service_Provider.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Pods\Admin; |
| 4 | |
| 5 | // Don't load directly. |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | die( '-1' ); |
| 8 | } |
| 9 | |
| 10 | use Pods\Admin\Config\Pod; |
| 11 | use Pods\Admin\Config\Group; |
| 12 | use Pods\Admin\Config\Field; |
| 13 | |
| 14 | /** |
| 15 | * Class Service_Provider. |
| 16 | * |
| 17 | * @since 2.8.0 |
| 18 | */ |
| 19 | class Service_Provider extends \Pods\Service_Provider_Base { |
| 20 | |
| 21 | /** |
| 22 | * Registers the classes and functionality needed for Admin configs. |
| 23 | * |
| 24 | * @since 2.8.0 |
| 25 | */ |
| 26 | public function register() { |
| 27 | $this->container->singleton( Pod::class, Pod::class ); |
| 28 | $this->container->singleton( Group::class, Group::class ); |
| 29 | $this->container->singleton( Field::class, Field::class ); |
| 30 | $this->container->singleton( Settings::class, Settings::class ); |
| 31 | |
| 32 | $this->hooks(); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Hooks all the methods and actions the class needs. |
| 37 | * |
| 38 | * @since 2.8.0 |
| 39 | */ |
| 40 | protected function hooks() { |
| 41 | add_action( 'pods_admin_settings_init', $this->container->callback( Settings::class, 'hook' ) ); |
| 42 | } |
| 43 | } |
| 44 |