taxonomy = $taxonomy; } /** * Key. */ public function key(): string { return 'attribute'; } /** * Label. */ public function label(): string { $id = function_exists( 'wc_attribute_taxonomy_id_by_name' ) ? (int) wc_attribute_taxonomy_id_by_name( $this->taxonomy ) : 0; $attribute = $id && function_exists( 'wc_get_attribute' ) ? wc_get_attribute( $id ) : null; return 'Global attribute' . ( $attribute ? ' "' . $attribute->name . '"' : '' ); } /** * Taxonomy. */ public function taxonomy(): string { return $this->taxonomy; } /** * Storage kind. */ public function storage(): string { return 'attribute'; } /** * Available when the pa_* attribute is registered in WooCommerce. */ public function available(): bool { return TermFields::is_attribute_taxonomy( $this->taxonomy ); } /** * Changeset field. */ public function field(): string { return TermFields::ATTRIBUTE . $this->taxonomy; } }