File: /mnt/data/truelysell-wp/wp-content/plugins/truelysell-elementor/widgets/class-contact-iconbox.php
<?php
/**
* Awesomesauce class.
*
* @category Class
* @package ElementorAwesomesauce
* @subpackage WordPress
* @author Ben Marshall <[email protected]>
* @copyright 2020 Ben Marshall
* @license https://opensource.org/licenses/GPL-3.0 GPL-3.0-only
* @link link(https://www.benmarshall.me/build-custom-elementor-widgets/,
* Build Custom Elementor Widgets)
* @since 1.0.0
* php version 7.3.9
*/
namespace ElementorTruelysell\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
if ( ! defined( 'ABSPATH' ) ) {
// Exit if accessed directly.
exit;
}
/**
* Awesomesauce widget class.
*
* @since 1.0.0
*/
class Truelysell_Contact_Icon extends Widget_Base {
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'truelysell-contacticonbox';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Truelysell Contact Icon Box', 'truelysell_elementor' );
}
/**
* Retrieve the widget icon.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-icon-box';
}
/**
* Retrieve the list of categories the widget belongs to.
*
* Used to determine where to display the widget in the editor.
*
* Note that currently Elementor supports only one category.
* When multiple categories passed, Elementor uses the first one.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return array( 'truelysell' );
}
/**
* Register the widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.0.0
*
* @access protected
*/
protected function _register_controls() {
// 'title' => 'Service Title',
// 'url' => '',
// 'url_title' => '',
// 'icon' => 'im im-icon-Office',
// 'type' => 'box-1', // 'box-1, box-1 rounded, box-2, box-3, box-4'
// 'with_line' => 'yes',
$this->start_controls_section(
'section_content',
array(
'label' => __( 'Content', 'truelysell_elementor' ),
)
);
$this->add_control(
'title',
array(
'label' => __( 'Title', 'truelysell_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Title', 'truelysell_elementor' ),
)
);
$this->add_control(
'box_icon',
array(
'label' => __( 'Icon', 'truelysell_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'ti ti-phone text-primary', 'truelysell_elementor' ),
)
);
$this->add_control(
'content',
array(
'label' => __( 'Content', 'truelysell_elementor' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'Content', 'truelysell_elementor' ),
)
);
$this->end_controls_section();
/* Add the options you'd like to show in this tab here */
}
/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
*
* @access protected
*/
protected function render() {
$settings = $this->get_settings_for_display();
$this->add_inline_editing_attributes( 'title', 'none' );
$this->add_inline_editing_attributes( 'subtitle', 'none' );
?>
<div class="card flex-fill">
<div class="card-body">
<div class="d-flex align-items-center">
<span class="rounded-circle"><i class="<?php echo $this->get_settings( 'box_icon' ) ?>"></i></span>
<div>
<h6 class="fs-18 mb-1"><?php echo $this->get_settings( 'title' ) ?></h6>
<p class="fs-14"><?php echo $this->get_settings( 'content' ) ?></p>
</div>
</div>
</div>
</div>
<?php
}
}