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