abstract-post-modifier.php
1 year ago
base-post-action.php
1 year ago
insert-action.php
1 year ago
post-author-property.php
1 year ago
post-comments-property.php
1 year ago
post-content-property.php
1 year ago
post-date-gmt-property.php
1 year ago
post-date-property.php
1 year ago
post-excerpt-property.php
1 year ago
post-id-property.php
1 year ago
post-meta-property.php
1 year ago
post-modifier.php
1 year ago
post-parent-property.php
1 year ago
post-status-property.php
1 year ago
post-terms-property.php
1 year ago
post-thumbnail-property.php
1 year ago
post-title-property.php
1 year ago
post-type-property.php
1 year ago
trash-action.php
1 year ago
update-action.php
1 year ago
abstract-post-modifier.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Modules\Actions_V2\Insert_Post\Properties; |
| 5 | |
| 6 | use Jet_Form_Builder\Actions\Methods\Abstract_Modifier; |
| 7 | use JFB_Modules\Actions_V2\Insert_Post\Insert_Post_Action; |
| 8 | |
| 9 | // If this file is called directly, abort. |
| 10 | if ( ! defined( 'WPINC' ) ) { |
| 11 | die; |
| 12 | } |
| 13 | |
| 14 | abstract class Abstract_Post_Modifier extends Abstract_Modifier { |
| 15 | |
| 16 | abstract public function is_supported( Insert_Post_Action $action ): bool; |
| 17 | |
| 18 | abstract public function get_id(): string; |
| 19 | |
| 20 | public function before_run( Insert_Post_Action $action ) { |
| 21 | $request = jet_fb_context()->resolve_request(); |
| 22 | $fields_map = $action->settings['fields_map'] ?? array(); |
| 23 | $post_status = $action->settings['post_status'] ?? ''; |
| 24 | $default_meta = $action->settings['default_meta'] ?? array(); |
| 25 | |
| 26 | $this->set( 'post_status', $post_status ); |
| 27 | |
| 28 | /** @var Post_Meta_Property $meta */ |
| 29 | $meta = $this->get( 'meta_input' ); |
| 30 | $meta->set_meta( Post_Meta_Property::prepare_meta( $default_meta ) ); |
| 31 | |
| 32 | $this->set_fields_map( $fields_map ); |
| 33 | $this->set_request( $request ); |
| 34 | } |
| 35 | |
| 36 | } |
| 37 |