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