| @@ 74-85 (lines=12) @@ | ||
| 71 | * | |
| 72 | * @synopsis --pod=<pod> --item=<item> | |
| 73 | */ | |
| 74 | 	function duplicate( $args, $assoc_args ) { | |
| 75 | ||
| 76 | $id = pods( $assoc_args['pod'], $assoc_args['item'] )->duplicate(); | |
| 77 | ||
| 78 | 		if ( 0 < $id ) { | |
| 79 | WP_CLI::success( __( 'Pod item duplicated', 'pods' ) ); | |
| 80 | 			WP_CLI::line( "New ID: {$id}" ); | |
| 81 | 		} else { | |
| 82 | WP_CLI::error( __( 'Error duplicating pod item', 'pods' ) ); | |
| 83 | } | |
| 84 | ||
| 85 | } | |
| 86 | ||
| 87 | /** | |
| 88 | * | |
| @@ 13-28 (lines=16) @@ | ||
| 10 | * @synopsis --name=<name> --type=<type> --<field>=<value> | |
| 11 | * @subcommand add-pod | |
| 12 | */ | |
| 13 | 	function add_pod( $args, $assoc_args ) { | |
| 14 | ||
| 15 | 		if ( isset( $assoc_args['id'] ) ) { | |
| 16 | unset( $assoc_args['id'] ); | |
| 17 | } | |
| 18 | ||
| 19 | $id = pods_api()->save_pod( $assoc_args ); | |
| 20 | ||
| 21 | 		if ( 0 < $id ) { | |
| 22 | WP_CLI::success( __( 'Pod added', 'pods' ) ); | |
| 23 | 			WP_CLI::line( "ID: {$id}" ); | |
| 24 | 		} else { | |
| 25 | WP_CLI::error( __( 'Error adding pod', 'pods' ) ); | |
| 26 | } | |
| 27 | ||
| 28 | } | |
| 29 | ||
| 30 | /** | |
| 31 | * | |