PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.7
Pods – Custom Content Types and Fields v3.2.7
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 / CLI / Service_Provider.php
pods / src / Pods / CLI Last commit date
Commands 3 years ago Service_Provider.php 3 years ago
Service_Provider.php
57 lines
1 <?php
2
3 namespace Pods\CLI;
4
5 use Pods\CLI\Commands\Field;
6 use Pods\CLI\Commands\Group;
7 use Pods\CLI\Commands\Playbook;
8 use Pods\CLI\Commands\Pod;
9 use Pods\CLI\Commands\Tools;
10 use WP_CLI;
11
12 /**
13 * Class Service_Provider
14 *
15 * Add CLI commands and objects.
16 *
17 * @since 2.8.0
18 */
19 class Service_Provider extends \Pods\Service_Provider_Base {
20
21 /**
22 * Binds and sets up implementations.
23 */
24 public $namespace;
25
26 /**
27 * Registers the classes and functionality needed for CLI.
28 *
29 * @since 2.8.0
30 */
31 public function register() {
32 $this->container->singleton( 'pods.cli.commands.pods.pod', Pod::class, [ 'hook' ] );
33 $this->container->singleton( 'pods.cli.commands.pods.group', Group::class, [ 'hook' ] );
34 $this->container->singleton( 'pods.cli.commands.pods.field', Field::class, [ 'hook' ] );
35
36 $this->hooks();
37 }
38
39 /**
40 * Hooks all the methods and actions the class needs.
41 *
42 * @since 2.8.0
43 */
44 protected function hooks() {
45 // Add dynamic commands.
46 pods_container( 'pods.cli.commands.pods.pod' );
47 pods_container( 'pods.cli.commands.pods.group' );
48 pods_container( 'pods.cli.commands.pods.field' );
49
50 // Add static commands.
51 if ( defined( 'WP_CLI' ) ) {
52 WP_CLI::add_command( 'pods playbook', Playbook::class );
53 WP_CLI::add_command( 'pods tools', Tools::class );
54 }
55 }
56 }
57