jetformbuilder
/
compatibility
/
woocommerce
/
methods
/
wc-product-modification
/
wc-product-modifier.php
base-product-property.php
2 years ago
product-backorders-property.php
2 years ago
product-catalog-visibility-property.php
2 years ago
product-cross-sell-ids-property.php
2 years ago
product-date-on-sale-from-property.php
2 years ago
product-date-on-sale-to-property.php
2 years ago
product-date-property.php
2 years ago
product-description-property.php
2 years ago
product-featured-property.php
2 years ago
product-gallery-property.php
2 years ago
product-height-property.php
2 years ago
product-id-property.php
2 years ago
product-image-property.php
2 years ago
product-length-property.php
2 years ago
product-low-stock-amount-property.php
2 years ago
product-manage-stock-property.php
2 years ago
product-name-property.php
2 years ago
product-parent-property.php
2 years ago
product-regular-price-property.php
2 years ago
product-reviews-allowed-property.php
2 years ago
product-sale-price-property.php
2 years ago
product-short-description-property.php
2 years ago
product-sku-property.php
2 years ago
product-sold-individually-property.php
2 years ago
product-status-property.php
2 years ago
product-stock-quantity-property.php
2 years ago
product-stock-status-property.php
2 years ago
product-tax-class-property.php
2 years ago
product-tax-status-property.php
2 years ago
product-total-sales-property.php
2 years ago
product-upsell-ids-property.php
2 years ago
product-weight-property.php
2 years ago
product-width-property.php
2 years ago
save-action.php
2 years ago
trash-action.php
2 years ago
wc-product-modifier.php
2 years ago
wc-product-modifier.php
93 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Compatibility\Woocommerce\Methods\Wc_Product_Modification; |
| 5 | |
| 6 | use Jet_Form_Builder\Actions\Methods\Object_Properties_Collection; |
| 7 | use JFB_Modules\Actions_V2\Insert_Post\Properties\Abstract_Post_Modifier; |
| 8 | use JFB_Modules\Actions_V2\Insert_Post\Properties\Post_Meta_Property; |
| 9 | use JFB_Modules\Actions_V2\Insert_Post\Properties\Post_Terms_Property; |
| 10 | use Jet_Form_Builder\Classes\Arrayable\Collection; |
| 11 | use JFB_Modules\Actions_V2\Insert_Post\Insert_Post_Action; |
| 12 | |
| 13 | // If this file is called directly, abort. |
| 14 | if ( ! defined( 'WPINC' ) ) { |
| 15 | die; |
| 16 | } |
| 17 | |
| 18 | class Wc_Product_Modifier extends Abstract_Post_Modifier { |
| 19 | |
| 20 | public function is_supported( Insert_Post_Action $action ): bool { |
| 21 | return 'product' === $action->get_post_type(); |
| 22 | } |
| 23 | |
| 24 | public function get_id(): string { |
| 25 | return 'product'; |
| 26 | } |
| 27 | |
| 28 | public function before_run( Insert_Post_Action $action ) { |
| 29 | parent::before_run( $action ); |
| 30 | |
| 31 | // for property post_title |
| 32 | $this->source_arr['post_type'] = 'product'; |
| 33 | } |
| 34 | |
| 35 | protected function get_properties(): Object_Properties_Collection { |
| 36 | return apply_filters( |
| 37 | 'jet-form-builder/wc-product-modifier/object-properties', |
| 38 | new Object_Properties_Collection( |
| 39 | array( |
| 40 | new Product_Id_Property(), |
| 41 | new Product_Name_Property(), |
| 42 | new Product_Status_Property(), |
| 43 | new Product_Description_Property(), |
| 44 | new Product_Short_Description_Property(), |
| 45 | new Product_Date_Property(), |
| 46 | new Product_Image_Property(), |
| 47 | new Product_Reviews_Allowed_Property(), |
| 48 | new Product_Parent_Property(), |
| 49 | new Post_Meta_Property(), |
| 50 | new Post_Terms_Property(), |
| 51 | new Product_Featured_Property(), |
| 52 | new Product_Catalog_Visibility_Property(), |
| 53 | new Product_Sku_Property(), |
| 54 | new Product_Regular_Price_Property(), |
| 55 | new Product_Sale_Price_Property(), |
| 56 | new Product_Date_On_Sale_From_Property(), |
| 57 | new Product_Date_On_Sale_To_Property(), |
| 58 | new Product_Total_Sales_Property(), |
| 59 | new Product_Tax_Status_Property(), |
| 60 | new Product_Tax_Class_Property(), |
| 61 | new Product_Manage_Stock_Property(), |
| 62 | new Product_Stock_Quantity_Property(), |
| 63 | new Product_Stock_Status_Property(), |
| 64 | new Product_Backorders_Property(), |
| 65 | new Product_Low_Stock_Amount_Property(), |
| 66 | new Product_Sold_Individually_Property(), |
| 67 | new Product_Weight_Property(), |
| 68 | new Product_Length_Property(), |
| 69 | new Product_Width_Property(), |
| 70 | new Product_Height_Property(), |
| 71 | new Product_Upsell_Ids_Property(), |
| 72 | new Product_Cross_Sell_Ids_Property(), |
| 73 | new Product_Gallery_Property(), |
| 74 | ) |
| 75 | ) |
| 76 | ); |
| 77 | } |
| 78 | |
| 79 | public function get_actions(): Collection { |
| 80 | return apply_filters( |
| 81 | 'jet-form-builder/product-modifier/object-actions', |
| 82 | new Collection( |
| 83 | array( |
| 84 | new Trash_Action(), |
| 85 | new Save_Action(), |
| 86 | ) |
| 87 | ) |
| 88 | ); |
| 89 | } |
| 90 | |
| 91 | |
| 92 | } |
| 93 |