𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/tdhomesa/public_html/wp-content/plugins/elementor-selio/widgets//video-feature.php
<?php
namespace ElementorSelio\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
use Elementor\Editor;
use Elementor\Plugin;
use Top_Nav_Menu_Walker;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* @since 1.1.0
*/
class Video_Feature extends Widget_Base {
public static $multiple_instance=false;
// Default widget settings
private $defaults = array(
array(
'feature_title' => 'Support information',
'feature_text' => 'Aenean sollicitudin, lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit. Duis sed odio sit amet nibh vulputate cursus a sit amet mauris. Morbi accumsan ipsum velit. Nam nec tellus a odio tincint auctor a ornare odi non mauris vitae erat consequat.',
'feature_button_text' => 'Contact Support',
'feature_button_link' => '#',
),
array(
'feature_image' => '',
'feature_video' => 'https://www.youtube.com/watch?v=hWo-43ObCP8',
),
);
private $items_num = 2;
/**
* Retrieve the widget name.
*
* @since 1.1.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'video-feature';
}
/**
* Retrieve the widget title.
*
* @since 1.1.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Video Feature', 'selio-blocks' );
}
/**
* Retrieve the widget icon.
*
* @since 1.1.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-play';
}
/**
* 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.1.0
*
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return [ 'winter-themes' ];
}
/**
* Register the widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.1.0
*
* @access protected
*/
protected function register_controls() {
if(!isset($this->defaults[0]))return;
$this->start_controls_section(
'section_elements',
[
'label' => __( 'Block elements', 'selio-blocks' ),
]
);
for($i=0;$i<$this->items_num;$i++)
{
$item_elements = $this->defaults[0];
if(isset($this->defaults[$i]))
{
$item_elements = $this->defaults[$i];
}
foreach($item_elements as $key=>$val)
{
$gen_item = 'item_'.($i+1).'_'.$key;
$gen_label = ucwords(str_replace('_', ' ', $key));
if(substr_count($key, 'pac') > 0)
$gen_label = $i.'. '.ucwords(str_replace('_', ' ', $key));
if(substr_count($key, 'link') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::TEXT,
'default' => $val,
]
);
}
elseif(substr_count($key, 'color') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::COLOR,
'default' => $val,
]
);
}
elseif(substr_count($key, 'enable') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::SWITCHER,
'options' => [
'yes' => __( 'Yes', 'selio-blocks' ),
'no' => __( 'No', 'selio-blocks' ),
],
'default' => $val,
]
);
}
elseif(substr_count($key, 'view') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::SELECT,
'options' => [
'' => __( 'Standard grid', 'selio-blocks' ),
'flexbox' => __( 'Flexbox', 'selio-blocks' ),
],
'default' => '',
]
);
}
elseif(substr_count($key, 'image') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
]
]
);
}
elseif(substr_count($key, 'description') > 0)
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::TEXT,
'default' => $val,
]
);
}
else
{
$this->add_control(
$gen_item,
[
'label' => $gen_label,
'type' => Controls_Manager::TEXT,
'default' => $val,
]
);
}
}
}
$this->end_controls_section();
}
/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.1.0
*
* @access protected
*/
protected function render() {
$settings = $this->get_settings();
/*
if(self::$multiple_instance === true)
{
echo '<div class="alert alert-info" role="alert" style="margin-top:20px;">'
.__('Multiple instance not allowed for: ','selio-blocks').' '.$this->get_title()
.'</div>';
return;
}
*/
if ( empty( $settings['item_1_feature_button_link']) || $settings['item_1_feature_button_link'] =='#' ) {
$page = selio_el_page_by_title('Contact', 'OBJECT', 'page' );
if($page) {
$settings['item_1_feature_button_link'] = get_permalink($page->ID);
}
}
if ( empty( $settings['item_2_feature_image']['id'] ) ) {
$settings['item_2_feature_image']['url'] = SELIO_THEMEROOT.'/assets/images/resources/video-img.jpg';
}
for($i=0;$i<$this->items_num;$i++)
{
$item_elements = $this->defaults[0];
if(isset($this->defaults[$i]))
{
$item_elements = $this->defaults[$i];
}
foreach($item_elements as $key=>$val)
{
$gen_item = 'item_'.($i+1).'_'.$key;
if(substr_count($gen_item, 'title') > 0 ||
substr_count($gen_item, 'line') > 0 ||
substr_count($gen_item, 'price') > 0 )
{
$this->add_inline_editing_attributes( $gen_item, 'basic' );
$this->add_render_attribute( $gen_item, [
'class' => ''
] );
}
elseif(substr_count($gen_item, 'text') > 0)
{
$this->add_inline_editing_attributes( $gen_item, 'basic' );
$this->add_render_attribute( $gen_item, [
'class' => ''
] );
}
elseif(substr_count($gen_item, 'button') > 0)
{
$this->add_inline_editing_attributes( $gen_item, 'basic' );
$this->add_render_attribute( $gen_item, [
'class' => 'btn btn-default'
] );
}
else
{
}
}
}
?>
<h2 class="vis-hid"><?php echo esc_html__('Video elementor','selio-blocks');?></h2>
<section class="feature-support-sec section-padding">
<div class="container">
<div class="support-sec">
<div class="row">
<div class="col-lg-8 col-md-12 pl-0">
<a href="<?php echo $settings['item_2_feature_video']; ?>" title="" class="html5lightbox">
<div class="video-img">
<img src="<?php echo $settings['item_2_feature_image']['url']; ?>" alt="<?php echo esc_html(selio_el_get_image_alt($settings['item_2_feature_image']['id']));?>">
<span class="video-play"><i class="fa fa-youtube-play"></i></span>
</div><!--video-img end-->
</a>
</div>
<div class="col-lg-4 col-md-12 pr-0">
<div class="support-info">
<h3 <?php echo $this->get_render_attribute_string( 'item_1_feature_title' ); ?>><?php echo $settings['item_1_feature_title']; ?></h3>
<p <?php echo $this->get_render_attribute_string( 'item_1_feature_text' ); ?>><?php echo $settings['item_1_feature_text']; ?></p>
<?php if(!empty($settings['item_1_feature_button_text']) && !empty($settings['item_1_feature_button_link'])): ?>
<a href="<?php echo $settings['item_1_feature_button_link']; ?>" title="" class="btn2"><?php echo $settings['item_1_feature_button_text']; ?></a>
<?php endif; ?>
</div><!--support-info end-->
</div>
</div>
</div><!--support-sec end-->
</div>
<br style="clear:both;" />
</section><!--feature-support-sec end-->
<?php if(Plugin::$instance->editor->is_edit_mode()): ?>
<script>
</script>
<?php endif; ?>
<?php
self::$multiple_instance = true;
}
}