@@ -13,64 +13,64 @@ |
||
| 13 | 13 | class PriceMutation |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Maps the GraphQL input to a format that the model functions can use |
|
| 18 | - * |
|
| 19 | - * @param array $input Data coming from the GraphQL mutation query input |
|
| 20 | - * @return array |
|
| 21 | - */ |
|
| 22 | - public static function prepareFields(array $input) |
|
| 23 | - { |
|
| 24 | - $args = []; |
|
| 16 | + /** |
|
| 17 | + * Maps the GraphQL input to a format that the model functions can use |
|
| 18 | + * |
|
| 19 | + * @param array $input Data coming from the GraphQL mutation query input |
|
| 20 | + * @return array |
|
| 21 | + */ |
|
| 22 | + public static function prepareFields(array $input) |
|
| 23 | + { |
|
| 24 | + $args = []; |
|
| 25 | 25 | |
| 26 | - // amount can be 0 |
|
| 27 | - if (array_key_exists('amount', $input)) { |
|
| 28 | - $args['PRC_amount'] = (float) $input['amount']; |
|
| 29 | - } |
|
| 26 | + // amount can be 0 |
|
| 27 | + if (array_key_exists('amount', $input)) { |
|
| 28 | + $args['PRC_amount'] = (float) $input['amount']; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - if (isset($input['description'])) { |
|
| 32 | - $args['PRC_desc'] = sanitize_text_field($input['description']); |
|
| 33 | - } |
|
| 31 | + if (isset($input['description'])) { |
|
| 32 | + $args['PRC_desc'] = sanitize_text_field($input['description']); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - if (array_key_exists('isDefault', $input)) { |
|
| 36 | - $args['PRC_is_default'] = (bool) $input['isDefault']; |
|
| 37 | - } |
|
| 35 | + if (array_key_exists('isDefault', $input)) { |
|
| 36 | + $args['PRC_is_default'] = (bool) $input['isDefault']; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - if (array_key_exists('isTrashed', $input)) { |
|
| 40 | - $args['PRC_deleted'] = (bool) $input['isTrashed']; |
|
| 41 | - } |
|
| 39 | + if (array_key_exists('isTrashed', $input)) { |
|
| 40 | + $args['PRC_deleted'] = (bool) $input['isTrashed']; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - if (isset($input['name'])) { |
|
| 44 | - $args['PRC_name'] = sanitize_text_field($input['name']); |
|
| 45 | - } |
|
| 43 | + if (isset($input['name'])) { |
|
| 44 | + $args['PRC_name'] = sanitize_text_field($input['name']); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - if (! empty($input['order'])) { |
|
| 48 | - $args['PRC_order'] = (int) $input['order']; |
|
| 49 | - } |
|
| 47 | + if (! empty($input['order'])) { |
|
| 48 | + $args['PRC_order'] = (int) $input['order']; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - if (! empty($input['overrides'])) { |
|
| 52 | - $args['PRC_overrides'] = (int) $input['overrides']; |
|
| 53 | - } |
|
| 51 | + if (! empty($input['overrides'])) { |
|
| 52 | + $args['PRC_overrides'] = (int) $input['overrides']; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if (! empty($input['parent'])) { |
|
| 56 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
|
| 57 | - $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
| 58 | - } |
|
| 55 | + if (! empty($input['parent'])) { |
|
| 56 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
|
| 57 | + $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - if (! empty($input['priceType'])) { |
|
| 61 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
|
| 62 | - $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
| 63 | - } |
|
| 60 | + if (! empty($input['priceType'])) { |
|
| 61 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
|
| 62 | + $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - if (! empty($input['wpUser'])) { |
|
| 66 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
|
| 67 | - $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
| 68 | - } |
|
| 65 | + if (! empty($input['wpUser'])) { |
|
| 66 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
|
| 67 | + $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - return apply_filters( |
|
| 71 | - 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__price_args', |
|
| 72 | - $args, |
|
| 73 | - $input |
|
| 74 | - ); |
|
| 75 | - } |
|
| 70 | + return apply_filters( |
|
| 71 | + 'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__price_args', |
|
| 72 | + $args, |
|
| 73 | + $input |
|
| 74 | + ); |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -44,27 +44,27 @@ |
||
| 44 | 44 | $args['PRC_name'] = sanitize_text_field($input['name']); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if (! empty($input['order'])) { |
|
| 47 | + if ( ! empty($input['order'])) { |
|
| 48 | 48 | $args['PRC_order'] = (int) $input['order']; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if (! empty($input['overrides'])) { |
|
| 51 | + if ( ! empty($input['overrides'])) { |
|
| 52 | 52 | $args['PRC_overrides'] = (int) $input['overrides']; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (! empty($input['parent'])) { |
|
| 55 | + if ( ! empty($input['parent'])) { |
|
| 56 | 56 | $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
| 57 | 57 | $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if (! empty($input['priceType'])) { |
|
| 60 | + if ( ! empty($input['priceType'])) { |
|
| 61 | 61 | $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
| 62 | 62 | $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if (! empty($input['wpUser'])) { |
|
| 65 | + if ( ! empty($input['wpUser'])) { |
|
| 66 | 66 | $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
| 67 | - $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
| 67 | + $args['PRC_wp_user'] = ( ! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return apply_filters( |