PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.17
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.17
1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 1.9.13 All 162 releases
woocommerce-pos / includes / API / V1 / Product_Brands_Controller.php

Product_Brands_Controller.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.17, at includes/API/V1/Product_Brands_Controller.php

88 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Product_Brands_Controller.
4 *
5 * @package WCPOS\WooCommercePOS
6 */
7
8 namespace WCPOS\WooCommercePOS\API\V1;
9
10 \defined( 'ABSPATH' ) || die;
11
12 if ( ! class_exists( 'WC_REST_Product_Brands_Controller' ) ) {
13 return;
14 }
15
16 use WC_REST_Product_Brands_Controller;
17 use WP_REST_Request;
18 use WP_REST_Response;
19
20 /**
21 * Product Brands controller class.
22 *
23 * @NOTE: methods not prefixed with wcpos_ will override WC_REST_Product_Brands_Controller methods
24 */
25 class Product_Brands_Controller extends WC_REST_Product_Brands_Controller {
26 use Traits\Term_Controller;
27 use Traits\Uuid_Handler;
28 use Traits\WCPOS_REST_API;
29
30 /**
31 * Taxonomy served by this controller; also builds both WC hook names.
32 */
33 protected const WCPOS_TAXONOMY = 'product_brand';
34
35 /**
36 * Method registered on woocommerce_rest_prepare_product_brand.
37 */
38 protected const WCPOS_RESPONSE_FILTER = 'wcpos_product_brands_response';
39
40 /**
41 * Method registered on woocommerce_rest_product_brand_query.
42 */
43 protected const WCPOS_QUERY_FILTER = 'wcpos_product_brand_query';
44
45 /**
46 * Collection label used in bulk-ID fast-path error messages.
47 */
48 protected const WCPOS_ID_ERROR_LABEL = 'product brand';
49
50 /**
51 * Endpoint namespace.
52 *
53 * @var string
54 */
55 protected $namespace = 'wcpos/v1';
56
57 /**
58 * Filter the brand response.
59 *
60 * Kept as a named method because third-party code detaches it by this exact
61 * callback tuple; the behaviour lives in Traits\Term_Controller.
62 *
63 * @param WP_REST_Response $response The response object.
64 * @param object $item The original term object.
65 * @param WP_REST_Request $request Request object.
66 *
67 * @return WP_REST_Response $response The response object.
68 */
69 public function wcpos_product_brands_response( WP_REST_Response $response, object $item, WP_REST_Request $request ): WP_REST_Response {
70 return $this->wcpos_term_response( $response, $item );
71 }
72
73 /**
74 * Filter the brand query.
75 *
76 * Kept as a named method because third-party code detaches it by this exact
77 * callback tuple; the behaviour lives in Traits\Term_Controller.
78 *
79 * @param array $args Query arguments.
80 * @param WP_REST_Request $request Request object.
81 *
82 * @return array
83 */
84 public function wcpos_product_brand_query( array $args, WP_REST_Request $request ): array {
85 return $this->wcpos_term_query( $args );
86 }
87 }
88