PluginProbe
Tiered Pricing Table for WooCommerce / trunk
Tiered Pricing Table for WooCommerce vtrunk
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / src / Forms / MinimumOrderQuantityForm.php

MinimumOrderQuantityForm.php in Tiered Pricing Table for WooCommerce trunk, at src/Forms/MinimumOrderQuantityForm.php

39 lines 1007 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Forms;
2
3 use TierPricingTable\Core\ServiceContainer;
4
5 class MinimumOrderQuantityForm {
6
7 public static function render(
8 $role = null,
9 $loop = null,
10 $minimumOrderQuantity = null
11 ) {
12 ServiceContainer::getInstance()->getFileManager()->includeTemplate( 'admin/components/minimum-order-quantity-form.php',
13 array(
14 'role' => $role,
15 'loop' => $loop,
16 'minimum_order_quantity' => $minimumOrderQuantity,
17 ) );
18 }
19
20 public static function getDataFromRequest( $role = null, $loop = null, $request = null ) {
21
22 $data = array();
23
24 $fields = array(
25 'minimum_order_quantity' => function ( $quantity ) {
26 return ! is_null( $quantity ) && '' !== $quantity ? max( 1, intval( $quantity ) ) : null;
27 },
28 );
29
30 foreach ( $fields as $fieldKey => $sanitizeFunction ) {
31 $data[ $fieldKey ] = call_user_func( $sanitizeFunction,
32 Form::getFieldValue( $fieldKey, $role, $loop, null, $request ) );
33
34 }
35
36 return $data;
37 }
38 }
39