| 1 |
<?php namespace TierPricingTable\Addons\RequestAQuote\Frontend\Adapters; |
| 2 |
|
| 3 |
use TierPricingTable\Core\ServiceContainer; |
| 4 |
use TierPricingTable\PricingRule; |
| 5 |
|
| 6 |
class OptionsAdapter extends AbstractLayoutAdapter { |
| 7 |
|
| 8 |
public function registerHooks() { |
| 9 |
add_action( 'tiered_pricing_table/options/after_options', array( $this, 'renderFormPrompt' ), 10, 1 ); |
| 10 |
add_action( 'tiered_pricing_table/options/options', array( $this, 'render' ), 10, 2 ); |
| 11 |
} |
| 12 |
|
| 13 |
public function render( PricingRule $pricingRule, $settings = array() ) { |
| 14 |
$form = $this->getValidFormForIntegratedPosition( $pricingRule ); |
| 15 |
if ( ! $form ) { |
| 16 |
return; |
| 17 |
} |
| 18 |
|
| 19 |
$optionsStyle = $settings['options_style'] ?? 'default'; |
| 20 |
|
| 21 |
$productId = $pricingRule->getProductId(); |
| 22 |
ServiceContainer::getInstance()->getFileManager()->includeTemplate( |
| 23 |
'frontend/integrated/options.php', |
| 24 |
array( |
| 25 |
'form' => $form, |
| 26 |
'productId' => $productId, |
| 27 |
'optionsStyle' => $optionsStyle, |
| 28 |
'buttonHtml' => $this->getQuoteButtonHtml( $form, $productId, 'button alt wp-element-button', 'padding: 5px 10px;' ) |
| 29 |
), |
| 30 |
plugin_dir_path( dirname( __DIR__ ) ) . 'views/' |
| 31 |
); |
| 32 |
} |
| 33 |
} |
| 34 |
|