BuyButton.php
1 year ago
CollectionTag.php
1 year ago
CollectionTags.php
1 year ago
Media.php
1 year ago
PriceChoiceTemplate.php
1 year ago
PriceChooser.php
1 year ago
PriceData.php
1 year ago
Product.php
1 year ago
ProductCard.php
1 year ago
ProductData.php
1 year ago
Quantity.php
1 year ago
SaleBadge.php
1 year ago
SelectedPriceAdHocAmount.php
1 year ago
VariantPill.php
1 year ago
VariantPills.php
1 year ago
Quantity.php
81 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Integrations\Bricks\Elements; |
| 4 | |
| 5 | use SureCart\Integrations\Bricks\Concerns\ConvertsBlocks; |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; // Exit if accessed directly. |
| 9 | } |
| 10 | |
| 11 | /** |
| 12 | * Quantity element. |
| 13 | */ |
| 14 | class Quantity extends \Bricks\Element { |
| 15 | use ConvertsBlocks; // we have to use a trait since we can't extend the surecart class. |
| 16 | |
| 17 | /** |
| 18 | * Element category. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | public $category = 'SureCart Elements'; |
| 23 | |
| 24 | /** |
| 25 | * Element name. |
| 26 | * |
| 27 | * @var string |
| 28 | */ |
| 29 | public $name = 'surecart-product-quantity'; |
| 30 | |
| 31 | /** |
| 32 | * Element block name. |
| 33 | * |
| 34 | * @var string |
| 35 | */ |
| 36 | public $block_name = 'surecart/product-quantity'; |
| 37 | |
| 38 | /** |
| 39 | * Element icon. |
| 40 | * |
| 41 | * @var string |
| 42 | */ |
| 43 | public $icon = 'ti-plus'; |
| 44 | |
| 45 | /** |
| 46 | * Get element label. |
| 47 | * |
| 48 | * @return string |
| 49 | */ |
| 50 | public function get_label() { |
| 51 | return esc_html__( 'Quantity', 'surecart' ); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Set controls. |
| 56 | * |
| 57 | * @return void |
| 58 | */ |
| 59 | public function set_controls() { |
| 60 | $this->controls['label'] = array( |
| 61 | 'label' => esc_html__( 'Label', 'surecart' ), |
| 62 | 'type' => 'text', |
| 63 | ); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Render element. |
| 68 | * |
| 69 | * @return void |
| 70 | */ |
| 71 | public function render() { |
| 72 | $label = ! empty( $this->settings['label'] ) ? $this->settings['label'] : esc_html__( 'Quantity', 'surecart' ); |
| 73 | |
| 74 | echo $this->raw( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 75 | array( |
| 76 | 'label' => esc_attr( $label ), |
| 77 | ) |
| 78 | ); |
| 79 | } |
| 80 | } |
| 81 |