WC_REST_Product_Attributes_V1_Controller::get_taxonomy
Get attribute name.
Method of the class: WC_REST_Product_Attributes_V1_Controller{}
No Hooks.
Returns
String.
Usage
// protected - for code of main (parent) or child class $result = $this->get_taxonomy( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
WC_REST_Product_Attributes_V1_Controller::get_taxonomy() WC REST Product Attributes V1 Controller::get taxonomy code WC 10.3.6
protected function get_taxonomy( $request ) {
$attribute_id = $request['id'];
if ( empty( $attribute_id ) ) {
return '';
}
if ( isset( $this->taxonomies_by_id[ $attribute_id ] ) ) {
return $this->taxonomies_by_id[ $attribute_id ];
}
$taxonomy = WC()->call_function( 'wc_attribute_taxonomy_name_by_id', (int) $request['id'] );
if ( ! empty( $taxonomy ) ) {
$this->taxonomies_by_id[ $attribute_id ] = $taxonomy;
}
return $taxonomy;
}