PluginProbe
Tiered Pricing Table for WooCommerce / 7.1.7
Tiered Pricing Table for WooCommerce v7.1.7
8.0.2 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 All 91 releases
tier-pricing-table / src / Addons / RequestAQuote / Frontend / Adapters / BlocksAdapter.php

BlocksAdapter.php in Tiered Pricing Table for WooCommerce 7.1.7, at src/Addons/RequestAQuote/Frontend/Adapters/BlocksAdapter.php

39 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\RequestAQuote\Frontend\Adapters;
2
3 use TierPricingTable\Core\ServiceContainer;
4 use TierPricingTable\PricingRule;
5
6 class BlocksAdapter extends AbstractLayoutAdapter {
7
8 public function registerHooks() {
9 // Default
10 add_action( 'tiered_pricing_table/blocks/after_blocks', array( $this, 'renderFormPrompt' ), 10, 1 );
11 // Integrated
12 add_action( 'tiered_pricing_table/blocks/blocks', array( $this, 'render' ), 10, 2 );
13 }
14
15 public function render( PricingRule $pricingRule, $settings = array() ) {
16 $form = $this->getValidFormForIntegratedPosition( $pricingRule );
17 if ( ! $form ) {
18 return;
19 }
20
21 $blocksStyle = $settings['blocks_style'] ?? 'default';
22 $promptText = $form->getPromptText();
23 $formId = $form->getId();
24 $productId = $pricingRule->getProductId();
25
26 ServiceContainer::getInstance()->getFileManager()->includeTemplate(
27 'frontend/integrated/blocks.php',
28 array(
29 'form' => $form,
30 'productId' => $productId,
31 'blocksStyle' => $blocksStyle,
32 'promptText' => $promptText,
33 'buttonHtml' => $this->getQuoteButtonHtml( $form, $productId, '', '', 'tpt-raq-link', true )
34 ),
35 plugin_dir_path( dirname( __DIR__ ) ) . 'views/'
36 );
37 }
38 }
39