WCML_Status_Taxonomies_UI

The WooCommerce Multilingual WCML Status Taxonomies UI class.

Defined (1)

The class is defined in the following location(s).

/inc/template-classes/status/class-wcml-status-taxonomies-ui.php  
  1. class WCML_Status_Taxonomies_UI extends WPML_Templates_Factory { 
  2.  
  3. private $woocommerce_wpml; 
  4.  
  5. function __construct( &$woocommerce_wpml ) { 
  6. parent::__construct(); 
  7.  
  8. $this->woocommerce_wpml = $woocommerce_wpml; 
  9.  
  10. public function get_model() { 
  11.  
  12. $model = array( 
  13. 'taxonomies' => $this->get_taxonomies_data(),  
  14. 'strings' => array( 
  15. 'tax_missing' => __( 'Taxonomies Missing Translations', 'woocommerce-multilingual' ),  
  16. 'run_site' => __( 'To run a fully translated site, you should translate all taxonomy terms. Some store elements, such as variations, depend on taxonomy translation.', 'woocommerce-multilingual' ),  
  17. 'not_req_trnsl' => __( '%s do not require translation.', 'woocommerce-multilingual' ),  
  18. 'req_trnsl' => __( 'This taxonomy requires translation.', 'woocommerce-multilingual' ),  
  19. 'miss_trnsl_one' => __( '%d %s is missing translations.', 'woocommerce-multilingual' ),  
  20. 'miss_trnsl_more' => __( '%d %s are missing translations.', 'woocommerce-multilingual' ),  
  21. 'trnsl' => __( 'Translate %s', 'woocommerce-multilingual' ),  
  22. 'doesnot_req_trnsl' => __( 'This taxonomy does not require translation.', 'woocommerce-multilingual' ),  
  23. 'all_trnsl' => __( 'All %s are translated.', 'woocommerce-multilingual' ),  
  24. 'not_to_trnsl' => __( 'Right now, there are no taxonomy terms needing translation.', 'woocommerce-multilingual' ),  
  25. 'conf_warning' => sprintf( __( 'To configure product taxonomies or attributes as translatable or not translatable, go to the %sMultilingual Content Setup%s', 'woocommerce-multilingual' ), '<a href="'.admin_url('admin.php?page=wpml-translation-management%2Fmenu%2Fmain.php&sm=mcsetup#ml-content-setup-sec-8').'">', '</a>' ) 
  26. ),  
  27. 'nonces' => array( 
  28. 'ignore_tax' => wp_create_nonce( 'wcml_ingore_taxonomy_translation_nonce' ) 
  29. ); 
  30.  
  31. return $model; 
  32.  
  33.  
  34. private function get_taxonomies_data() { 
  35. $taxonomies = $this->woocommerce_wpml->terms->get_wc_taxonomies(); 
  36. $taxonomies_data = array(); 
  37.  
  38. foreach ( $taxonomies as $key => $taxonomy ) { 
  39. if( !is_taxonomy_translated( $taxonomy ) ) continue; 
  40. $taxonomies_data[$key]['tax'] = $taxonomy; 
  41. $taxonomies_data[$key]['untranslated'] = $this->woocommerce_wpml->terms->get_untranslated_terms_number($taxonomy); 
  42. $taxonomies_data[$key]['fully_trans'] = $this->woocommerce_wpml->terms->is_fully_translated($taxonomy); 
  43. $taxonomy_object = get_taxonomy($taxonomy); 
  44. $taxonomies_data[$key]['name'] = ucfirst( !empty( $taxonomy_object->labels->name ) ? $taxonomy_object->labels->name : $taxonomy_object->labels->singular_name ); 
  45. $taxonomies_data[$key]['name_singular'] = ucfirst( $taxonomy_object->labels->singular_name ); 
  46.  
  47. if( substr( $taxonomy, 0, 3 ) == 'pa_' ) { 
  48. $taxonomies_data[$key]['url'] = admin_url( 'admin.php?page=wpml-wcml&tab=product-attributes&taxonomy=' . $taxonomy ); 
  49. }else{ 
  50. $taxonomies_data[$key]['url'] = admin_url( 'admin.php?page=wpml-wcml&tab=' . $taxonomy ); 
  51.  
  52.  
  53. return $taxonomies_data; 
  54.  
  55.  
  56. public function init_template_base_dir() { 
  57. $this->template_paths = array( 
  58. WCML_PLUGIN_PATH . '/templates/status/',  
  59. ); 
  60.  
  61. public function get_template() { 
  62. return 'taxonomies.twig'; 
  63.