| 1 |
<?php namespace TierPricingTable\Addons\LayoutConfigurator; |
| 2 |
|
| 3 |
use TierPricingTable\Addons\AbstractAddon; |
| 4 |
|
| 5 |
/** |
| 6 |
* Layout configurator add-on: the visual editor for the product-page pricing layout with a live |
| 7 |
* preview. Switched off, the settings page shows the classic layout rows instead. |
| 8 |
*/ |
| 9 |
class LayoutConfiguratorAddon extends AbstractAddon { |
| 10 |
|
| 11 |
const SLUG = 'layout-configurator'; |
| 12 |
|
| 13 |
public function getName(): string { |
| 14 |
return __( 'Layout Configurator', 'tier-pricing-table' ); |
| 15 |
} |
| 16 |
|
| 17 |
public function getDescription(): string { |
| 18 |
return __( 'Visual editor for the product page pricing layout with a live preview. Switch it off to get the classic layout settings rows back.', 'tier-pricing-table' ); |
| 19 |
} |
| 20 |
|
| 21 |
public function getIcon(): string { |
| 22 |
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"/></svg>'; |
| 23 |
} |
| 24 |
|
| 25 |
public function getSlug(): string { |
| 26 |
return self::SLUG; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Whether the add-on is switched on. Same rule as isEnabled(), usable without an instance. |
| 31 |
*/ |
| 32 |
public static function isActive(): bool { |
| 33 |
return self::isAddonEnabled( self::SLUG ); |
| 34 |
} |
| 35 |
|
| 36 |
public function run() { |
| 37 |
$this->getContainer()->add( 'settings.layout_preview', new LayoutPreview() ); |
| 38 |
$this->getContainer()->add( 'settings.layout_configurator', new LayoutConfigurator() ); |
| 39 |
} |
| 40 |
} |
| 41 |
|