PluginProbe
Tiered Pricing Table for WooCommerce / trunk
Tiered Pricing Table for WooCommerce vtrunk
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / src / Addons / Tools / Settings / Settings.php

Settings.php in Tiered Pricing Table for WooCommerce trunk, at src/Addons/Tools/Settings/Settings.php

66 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\Tools\Settings;
2
3 use TierPricingTable\Settings\Settings as MainSettings;
4
5 class Settings {
6
7 public function __construct() {
8
9 add_filter( 'tiered_pricing_table/settings/sections', function ( $sections ) {
10
11 $_sections = array();
12
13 foreach ( $sections as $section ) {
14
15 if ( $section->getSlug() === 'advanced' ) {
16 $_sections[] = new ToolsSettingsSection();
17 }
18
19 $_sections[] = $section;
20 }
21
22 return $_sections;
23 }, 10 );
24
25 add_action( 'woocommerce_admin_field_tiered-pricing_tools-ui', function () {
26 ?>
27 <style>
28 p.submit {
29 display: none !important;
30 }
31 </style>
32 <tr valign="top">
33 <td colspan="2" class="forminp">
34 <div id="tiered-pricing__feature__tools"></div>
35 </td>
36 </tr>
37 <?php
38 } );
39
40 add_action( 'admin_enqueue_scripts', function () {
41
42 $settingsTab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : '';
43 $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : '';
44
45 if ( MainSettings::SETTINGS_PAGE !== $settingsTab ) {
46 return;
47 }
48
49 if ( 'tools' !== $section ) {
50 return;
51 }
52
53 $assetFile = include( plugin_dir_path( __FILE__ ) . '../build/index.asset.php' );
54
55 wp_enqueue_script( 'tiered-pricing/feature/tools',
56 plugins_url( 'build/index.js', dirname( __FILE__ . '../' ) ), $assetFile['dependencies'],
57 $assetFile['version'], true );
58
59 wp_set_script_translations( 'tiered-pricing/feature/tools', 'tier-pricing-table',
60 dirname( __FILE__, 5 ) . '/languages' );
61
62 wp_enqueue_style( 'wp-components' );
63 } );
64 }
65 }
66