| 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[] = new ToolsSettingsSection(); |
| 12 |
|
| 13 |
return $sections; |
| 14 |
}, 10 ); |
| 15 |
|
| 16 |
add_action( 'woocommerce_admin_field_tiered-pricing_tools-ui', function () { |
| 17 |
?> |
| 18 |
<style> |
| 19 |
p.submit { |
| 20 |
display: none !important; |
| 21 |
} |
| 22 |
</style> |
| 23 |
<tr valign="top"> |
| 24 |
<td colspan="2" class="forminp"> |
| 25 |
<div id="tiered-pricing__feature__tools"></div> |
| 26 |
</td> |
| 27 |
</tr> |
| 28 |
<?php |
| 29 |
} ); |
| 30 |
|
| 31 |
add_action( 'admin_enqueue_scripts', function () { |
| 32 |
|
| 33 |
$settingsTab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : ''; |
| 34 |
$section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : ''; |
| 35 |
|
| 36 |
if ( MainSettings::SETTINGS_PAGE !== $settingsTab ) { |
| 37 |
return; |
| 38 |
} |
| 39 |
|
| 40 |
if ( 'tools' !== $section ) { |
| 41 |
return; |
| 42 |
} |
| 43 |
|
| 44 |
$assetFile = include( plugin_dir_path( __FILE__ ) . '../build/index.asset.php' ); |
| 45 |
|
| 46 |
wp_enqueue_script( 'tiered-pricing/feature/tools', |
| 47 |
plugins_url( 'build/index.js', dirname( __FILE__ . '../' ) ), $assetFile['dependencies'], |
| 48 |
$assetFile['version'], true ); |
| 49 |
|
| 50 |
wp_enqueue_style( 'wp-components' ); |
| 51 |
} ); |
| 52 |
} |
| 53 |
} |
| 54 |
|