# propertyhive/2.2.2/includes/elementor-widgets/property-price.php

Property Hive, version 2.2.2. 131 lines.

- Page: https://pluginprobe.com/plugins/propertyhive/2.2.2/code/includes/elementor-widgets/property-price.php
- Raw: https://pluginprobe.com/plugins/propertyhive/2.2.2/raw/includes/elementor-widgets/property-price.php
- Modified: 2024-12-17T10:52:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/propertyhive/2.2.2/code/includes/elementor-widgets/property-price.php#L10-L20`.

```php
<?php
/**
 * Elementor Property Price Widget.
 *
 * @since 1.0.0
 */
class Elementor_Property_Price_Widget extends \Elementor\Widget_Base {

	public function get_name() {
		return 'property-price';
	}

	public function get_title() {
		return __( 'Price', 'propertyhive' );
	}

	public function get_icon() {
		return 'eicon-number-field';
	}

	public function get_categories() {
		return [ 'property-hive' ];
	}

	public function get_keywords() {
		return [ 'property hive', 'propertyhive', 'property', 'price' ];
	}

	protected function register_controls() {

		$this->start_controls_section(
			'style_section',
			[
				'label' => __( 'Price', 'propertyhive' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Typography::get_type(),
			[
				'name' => 'price_typography',
				'label' => __( 'Typography', 'propertyhive' ),
				'global' => [
					'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_PRIMARY,
				],
				'selector' => '{{WRAPPER}} .price',
			]
		);

		$this->add_control(
			'price_color',
			[
				'label' => __( 'Colour', 'propertyhive' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'global' => [
				    'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_PRIMARY,
				],
				'selectors' => [
					'{{WRAPPER}} .price' => 'color: {{VALUE}}',
				],
			]
		);

		$this->add_control(
			'text_align',
			[
				'label' => __( 'Alignment', 'propertyhive' ),
				'type' => \Elementor\Controls_Manager::CHOOSE,
				'options' => [
					'left' => [
						'title' => __( 'Left', 'propertyhive' ),
						'icon' => 'eicon-text-align-left',
					],
					'center' => [
						'title' => __( 'Center', 'propertyhive' ),
						'icon' => 'eicon-text-align-center',
					],
					'right' => [
						'title' => __( 'Right', 'propertyhive' ),
						'icon' => 'eicon-text-align-right',
					],
				],
				'default' => 'left',
				'toggle' => true,
				'selectors' => [
					'{{WRAPPER}} .price' => 'text-align: {{VALUE}}',
				],
			]
		);

		$this->add_control(
			'show_price_qualifier',
			[
				'label' => __( 'Show Price Qualifier', 'propertyhive' ),
				'type' => \Elementor\Controls_Manager::SWITCHER,
				'label_on' => __( 'Show', 'propertyhive' ),
				'label_off' => __( 'Hide', 'propertyhive' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);

		$this->end_controls_section();

	}

	protected function render() {

		global $property;

		$settings = $this->get_settings_for_display();

		if ( !isset($property->id) ) {
			return;
		}

		if ( isset($settings['show_price_qualifier']) && $settings['show_price_qualifier'] != 'yes' )
		{
?>
<style type="text/css">
.price .price-qualifier { display:none; }
</style>
<?php
		}

		propertyhive_template_single_price();

	}

}
```
