ddw_wcde_woocommerce_translation_settings

Array of admin setting fields - leveraging the WooCommerce settings API, using setting field types.

Description

(array) ddw_wcde_woocommerce_translation_settings(); 

Returns (array)

Array of admin setting fields.


Usage

  1. if ( !function_exists( 'ddw_wcde_woocommerce_translation_settings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-german-de_de/includes/wcde-settings-woocommerce.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ddw_wcde_woocommerce_translation_settings(); 
  7.  

Defined (1)

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

/includes/wcde-settings-woocommerce.php  
  1. function ddw_wcde_woocommerce_translation_settings() { 
  2.  
  3. $info_button = sprintf( 
  4. '<a class="button button-secondary" href="%1$s" title="%2$s"><strong>→ %2$s</strong></a>',  
  5. admin_url( 'index.php?page=deckerweb-translations&tab=woocommerce-german' ),  
  6. esc_html__( 'Important Legal Advise', 'woocommerce-german' ) 
  7. ); 
  8.  
  9. $donate_button = sprintf( 
  10. '<a class="button button-primary" href="%1$s" target="_new" title="%2$s"><strong>→ %2$s</strong></a>',  
  11. esc_url( 'http://deckerweb.de/sprachdateien/spenden/' ),  
  12. esc_html__( 'Donate NOW!', 'woocommerce-german' ) 
  13. ); 
  14.  
  15. $translation_section_desc = sprintf( 
  16. '<div class="alignright alternate" style="margin-left: 40px; padding: 0 15px; width: 30%;"> 
  17. <p>%1$s<br />%2$s</p> 
  18. <p>%3$s<br />%4$s</p> 
  19. </div> 
  20. <div> 
  21. <p>%5$s</p><p>%6$s</p> 
  22. </div><div class="clear"></div>',  
  23. __( 'Regardingtranslationsand shop owners:', 'woocommerce-german' ),  
  24. $info_button,  
  25. __( 'Donate for the maintenance of thetranslations', 'woocommerce-german' ),  
  26. $donate_button,  
  27. sprintf( 
  28. __( 'Those are the plugin settings for %s.', 'woocommerce-german' ),  
  29. '<em>' . __( 'WooCommerce German (de_DE)', 'woocommerce-german' ) . '</em>' 
  30. ),  
  31. __( 'Note: Settings are available after saving and reloading any admin page.', 'woocommerce-german' ) 
  32. ); 
  33.  
  34. $wcde_settings_fields = array( 
  35.  
  36. /** First setting section*/ 
  37. array( 
  38. 'title' => __( 'German Translation Options', 'woocommerce-german' ),  
  39. 'type' => 'title',  
  40. 'desc' => $translation_section_desc,  
  41. 'id' => 'wcde_translation_options' 
  42. ),  
  43.  
  44. /** Use formal translations? */ 
  45. array( 
  46. 'title' => __( 'Use German formal translations?', 'woocommerce-german' ),  
  47. 'id' => 'wcde_german_formal',  
  48. 'default' => ( get_option( 'woocommerce_informal_localisation_type' ) ) ? get_option( 'woocommerce_informal_localisation_type' ) : 'yes',  
  49. 'type' => 'radio',  
  50. 'options' => array( 
  51. 'yes' => __( 'Yes, I want formal language!', 'woocommerce-german' ),  
  52. 'no' => __( 'No, I want informal language', 'woocommerce-german' ) 
  53. ),  
  54. 'desc' => '<p>' . __( 'Default is: formal language - we also recommend to use this language pack is it fits way better with most shopping situations. Otherwise informaltranslationswill be loaded', 'woocommerce-german' ) . '</p>',  
  55. ),  
  56.  
  57. /** Translation loading location */ 
  58. array( 
  59. 'title' => __( 'Translation loading location', 'woocommerce-german' ),  
  60. 'desc' => '<p>' . __( 'Decide where to load thetranslations Global, or only on Frontend or only in the Admin Area?', 'woocommerce-german' ) . '</p>',  
  61. 'id' => 'wcde_loading_location',  
  62. 'default' => 'global',  
  63. 'type' => 'select',  
  64. 'class' => 'chosen_select',  
  65. 'options' => array( 
  66. 'global' => __( 'Both, on Frontend and Admin Area', 'woocommerce-german' ),  
  67. 'frontend_only' => __( 'Only on Frontend', 'woocommerce-german' ),  
  68. 'admin_only' => __( 'Only on Admin Area', 'woocommerce-german' ) 
  69. ),  
  70.  
  71. /** Also load packaged extensions translations? */ 
  72. array( 
  73. 'title' => __( 'Load included extensions\'s translations?', 'woocommerce-german' ),  
  74. 'desc' => __( 'Also load the translation files for the few packaged extension\'s translations?', 'woocommerce-german' ),  
  75. 'id' => 'wcde_load_extensions',  
  76. 'type' => 'checkbox',  
  77. 'default' => 'yes',  
  78. 'desc_tip' => sprintf( 
  79. __( 'If you have none of the currently %s in use, please deactivate this checkbox to save (translation) loading performance.', 'woocommerce-german' ),  
  80. '<a href="http://wordpress.org/plugins/woocommerce-de/other_notes/#Untersttzte-Extensions-(Erweiterungen)-/-Supported-Extensions" target="_new">' . __( 'supported extensions', 'woocommerce-german' ) . '</a>' 
  81. ),  
  82. ),  
  83.  
  84. /** Load internal string swap function? (global strings) */ 
  85. array( 
  86. 'title' => __( 'Load included string swap functions?', 'woocommerce-german' ),  
  87. 'desc' => __( 'Also load the included string swap functions?', 'woocommerce-german' ),  
  88. 'id' => 'wcde_load_string_swaps',  
  89. 'type' => 'checkbox',  
  90. 'default' => 'yes',  
  91. 'desc_tip' => __( 'If using WooCommerce as product catalog it\'s recommended to deactivate this checkbox to save (translation) loading performance.', 'woocommerce-german' ),  
  92. ),  
  93.  
  94. /** Load another internal string swap function? (admin strings) */ 
  95. array( 
  96. 'title' => __( 'Load included admin string swap functions?', 'woocommerce-german' ),  
  97. 'desc' => __( 'Also load the included string swap functions for the admin?', 'woocommerce-german' ),  
  98. 'id' => 'wcde_load_admin_string_swaps',  
  99. 'type' => 'checkbox',  
  100. 'default' => 'yes',  
  101. 'desc_tip' => __( 'If not needed for the admin it\'s recommended to deactivate this checkbox to save (translation) loading performance.', 'woocommerce-german' ),  
  102. ),  
  103.  
  104. /** End of first section */ 
  105. array( 
  106. 'type' => 'sectionend',  
  107. 'id' => 'wcde_translation_options' 
  108. ),  
  109.  
  110. ); // end of array 
  111.  
  112. /** Return the setting fields for display & saving */ 
  113. return (array) $wcde_settings_fields; 
  114.  
  115. } // end of function ddw_wcde_woocommerce_translation_settings