File: /storage/v6964/iskcon/public_html/wp-content/plugins/tow-widgets/widgets/elementor/tow-button.php
<?php
if (!defined("ABSPATH")) {
exit(); // Exit if accessed directly.
}
class Elementor_tow_button_Widget extends \Elementor\Widget_Base
{
/**
* Get widget name.
*/
public function get_name()
{
return "tow_button";
}
/**
* Get widget title.
*/
public function get_title()
{
return esc_html__("Tow Button", "Elementor_tow_button_Widget");
}
/**
* Get widget Icon.
*/
public function get_icon()
{
return "eicon-button";
}
/**
* Get widget categories.
*/
public function get_categories()
{
return ["tow-theme-element"];
}
/**
* Get widget keywords.
*/
public function get_keywords()
{
return ["button"];
}
/**
* Register widget controls.
*/
protected function register_controls()
{
$this->start_controls_section(
"content_section",
[
"label" => esc_html__(
"Content",
"Elementor_tow_button_Widget"
),
"tab" => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'button_style',
[
'label' => esc_html__( 'Button Style', 'Elementor_tow_button_Widget' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'button_1',
'options' => [
'button_1' => esc_html__( 'Button Dark', 'Elementor_tow_button_Widget' ),
'button_4' => esc_html__( 'Outline White', 'Elementor_tow_button_Widget' ),
'primary-btn' => esc_html__( 'Button Primary', 'Elementor_tow_button_Widget' ),
],
]
);
$this->add_control("button_text", [
"label" => esc_html__(
"Button Text",
"Elementor_tow_button_Widget"
),
"type" => \Elementor\Controls_Manager::TEXT,
"lable_block" => "true",
"placeholder" => esc_html__(
"Button Text Here",
"Elementor_tow_button_Widget"
),
]);
$this->add_control(
"btn_url",
[
"label" => esc_html__(
"URL to embed",
"Elementor_tow_button_Widget"
),
"type" => \Elementor\Controls_Manager::TEXT,
"input_type" => "url",
"placeholder" => esc_html__(
"https://your-link.com",
"Elementor_tow_button_Widget"
),
]
);
$this->add_control(
"alignment",
[
"type" => \Elementor\Controls_Manager::CHOOSE,
"label" => esc_html__("Alignment", "textdomain"),
"options" => [
"left" => [
"title" => esc_html__("Left", "textdomain"),
"icon" => "eicon-text-align-left",
],
"center" => [
"title" => esc_html__("Center", "textdomain"),
"icon" => "eicon-text-align-center",
],
"right" => [
"title" => esc_html__("Right", "textdomain"),
"icon" => "eicon-text-align-right",
],
],
]
);
$this->end_controls_section();
}
/**
* Render widget output on the frontend.
*/
protected function render()
{
// get our input from the widget settings.
$settings = $this->get_settings_for_display(); ?>
<div class="<?php echo esc_attr($settings["alignment"]); ?>">
<a href="<?php echo $settings["btn_url"]; ?>" class="themeht-btn <?php echo $settings["button_style"]; ?>"><?php echo $settings["button_text"]; ?><?php if($settings["button_style"]=="button_4"){?><i class="fa fa-arrow-right ms-1"></i><?php }?></a>
</div>
<?php
}
}