Orders
1 week ago
Products
1 week ago
Reports
1 week ago
Composite.php
1 week ago
Factory.php
1 week ago
Handler.php
1 week ago
ProductAttributes.php
1 week ago
ProductTerms.php
1 week ago
ProductAttributes.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Rest\Wrapper; |
| 4 | |
| 5 | use WCML_WC_Strings; |
| 6 | use WPML\FP\Obj; |
| 7 | |
| 8 | class ProductAttributes extends Handler { |
| 9 | |
| 10 | private $strings; |
| 11 | |
| 12 | public function __construct( |
| 13 | WCML_WC_Strings $strings |
| 14 | ) { |
| 15 | $this->strings = $strings; |
| 16 | } |
| 17 | |
| 18 | public function prepare( $response, $object, $request ) { |
| 19 | $langCode = Obj::prop( 'lang', $request->get_params() ); |
| 20 | |
| 21 | $response->data['name'] = $this->strings->get_translated_string_by_name_and_context( \WCML_WC_Strings::DOMAIN_WORDPRESS, \WCML_WC_Strings::TAXONOMY_SINGULAR_NAME_PREFIX . $object->attribute_label, $langCode, $object->attribute_label ); |
| 22 | |
| 23 | return $response; |
| 24 | } |
| 25 | |
| 26 | } |
| 27 |