| 1 |
<?php namespace TierPricingTable\Addons\CatalogPrices; |
| 2 |
|
| 3 |
use TierPricingTable\Addons\AbstractAddon; |
| 4 |
use TierPricingTable\Addons\LayoutConfigurator\LayoutConfiguratorAddon; |
| 5 |
|
| 6 |
class CatalogPricesAddon extends AbstractAddon { |
| 7 |
|
| 8 |
public function getName(): string { |
| 9 |
return __( 'Shop & Categories Price Format', 'tier-pricing-table' ); |
| 10 |
} |
| 11 |
|
| 12 |
public function getDescription() { |
| 13 |
return __( 'Manage how tiered pricing appears in catalogs, loops, and widgets.', 'tier-pricing-table' ); |
| 14 |
} |
| 15 |
|
| 16 |
public function getIcon(): string { |
| 17 |
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM10 9h8v2h-8zm0 3h4v2h-4zm0-6h8v2h-8z"/></svg>'; |
| 18 |
} |
| 19 |
|
| 20 |
public function getSlug() { |
| 21 |
return 'catalog-prices'; |
| 22 |
} |
| 23 |
|
| 24 |
public function run() { |
| 25 |
$this->getContainer()->initService( CatalogPricesService::class ); |
| 26 |
add_filter( 'tiered_pricing_table/settings/general_subsections', array( $this, 'addSettingsSubsection' ) ); |
| 27 |
} |
| 28 |
|
| 29 |
public function addSettingsSubsection( $subsections ) { |
| 30 |
// the layout configurator carries these options while it is on |
| 31 |
if ( LayoutConfiguratorAddon::isActive() ) { |
| 32 |
return $subsections; |
| 33 |
} |
| 34 |
|
| 35 |
$subsections[] = CatalogPricesSubsection::class; |
| 36 |
return $subsections; |
| 37 |
} |
| 38 |
} |
| 39 |
|