| @@ -5,22 +5,40 @@ | ||
| 5 | 5 | class Settings { |
| 6 | 6 | |
| 7 | 7 | public function __construct() { |
| 8 | 8 | |
| 9 | - add_filter( 'tiered_pricing_table/settings/sections', function ( $sections ) { | |
| 9 | + // the utilities panel on the Advanced tab, between the modules and the cache settings | |
| 10 | + add_filter( 'tiered_pricing_table/settings/tools_settings', function ( $settings ) { | |
| 11 | + return array_merge( array( | |
| 12 | + array( | |
| 13 | + // #roles: the "Manage roles" links land here, above the Utilities heading; the app also reads the hash as its tab | |
| 14 | + 'type' => 'tiered-pricing_tools-anchor', | |
| 15 | + ), | |
| 16 | + array( | |
| 17 | + 'title' => __( 'Utilities', 'tier-pricing-table' ), | |
| 18 | + 'desc' => __( 'Manage roles and clean up tiered pricing data.', 'tier-pricing-table' ), | |
| 19 | + 'id' => MainSettings::SETTINGS_PREFIX . 'tools_utilities', | |
| 20 | + 'type' => 'title', | |
| 21 | + ), | |
| 22 | + array( | |
| 23 | + 'type' => 'tiered-pricing_tools-ui', | |
| 24 | + ), | |
| 25 | + array( | |
| 26 | + 'type' => 'sectionend', | |
| 27 | + 'id' => MainSettings::SETTINGS_PREFIX . 'tools_utilities', | |
| 28 | + ), | |
| 29 | + ), $settings ); | |
| 30 | + } ); | |
| 10 | 31 | |
| 11 | - $sections[] = new ToolsSettingsSection(); | |
| 32 | + add_action( 'woocommerce_admin_field_tiered-pricing_tools-anchor', function () { | |
| 33 | + // printed between two settings tables, so it is not a table row; the scroll margin keeps the heading below the sticky bars | |
| 34 | + ?> | |
| 35 | + <div id="roles" style="scroll-margin-top: 90px;"></div> | |
| 36 | + <?php | |
| 37 | + } ); | |
| 12 | 38 | |
| 13 | - return $sections; | |
| 14 | - }, 10 ); | |
| 15 | - | |
| 16 | 39 | add_action( 'woocommerce_admin_field_tiered-pricing_tools-ui', function () { |
| 17 | 40 | ?> |
| 18 | - <style> | |
| 19 | - p.submit { | |
| 20 | - display: none !important; | |
| 21 | - } | |
| 22 | - </style> | |
| 23 | 41 | <tr valign="top"> |
| 24 | 42 | <td colspan="2" class="forminp"> |
| 25 | 43 | <div id="tiered-pricing__feature__tools"></div> |
| 26 | 44 | </td> |
| @@ -36,9 +54,9 @@ | ||
| 36 | 54 | if ( MainSettings::SETTINGS_PAGE !== $settingsTab ) { |
| 37 | 55 | return; |
| 38 | 56 | } |
| 39 | 57 | |
| 40 | - if ( 'tools' !== $section ) { | |
| 58 | + if ( ! in_array( $section, array( 'advanced', 'tools' ), true ) ) { // 'tools' is the pre-7.2.1 link | |
| 41 | 59 | return; |
| 42 | 60 | } |
| 43 | 61 | |
| 44 | 62 | $assetFile = include( plugin_dir_path( __FILE__ ) . '../build/index.asset.php' ); |
| @@ -45,9 +63,12 @@ | ||
| 45 | 63 | |
| 46 | 64 | wp_enqueue_script( 'tiered-pricing/feature/tools', |
| 47 | 65 | plugins_url( 'build/index.js', dirname( __FILE__ . '../' ) ), $assetFile['dependencies'], |
| 48 | 66 | $assetFile['version'], true ); |
| 49 | - | |
| 67 | + | |
| 68 | + wp_set_script_translations( 'tiered-pricing/feature/tools', 'tier-pricing-table', | |
| 69 | + dirname( __FILE__, 5 ) . '/languages' ); | |
| 70 | + | |
| 50 | 71 | wp_enqueue_style( 'wp-components' ); |
| 51 | 72 | } ); |
| 52 | 73 | } |
| 53 | 74 | } |