File: /home/lesanew/www/wp-content/plugins/neobeat-core/inc/shortcodes/video-slider/video-slider.php
<?php
if ( ! function_exists( 'neobeat_core_add_video_slider_shortcode' ) ) {
/**
* Function that add shortcode into shortcodes list for registration
*
* @param $shortcodes array
*
* @return array
*/
function neobeat_core_add_video_slider_shortcode( $shortcodes ) {
$shortcodes[] = 'NeoBeatCoreVideoSliderShortcode';
return $shortcodes;
}
add_filter( 'neobeat_core_filter_register_shortcodes', 'neobeat_core_add_video_slider_shortcode' );
}
if ( class_exists( 'NeoBeatCoreShortcode' ) ) {
class NeoBeatCoreVideoSliderShortcode extends NeoBeatCoreShortcode {
public function __construct() {
$this->set_layouts( apply_filters( 'neobeat_core_filter_video_slider_layouts', array() ) );
$this->set_extra_options( apply_filters( 'neobeat_core_filter_video_slider_extra_options', array() ) );
parent::__construct();
}
public function map_shortcode() {
$this->set_shortcode_path( NEOBEAT_CORE_SHORTCODES_URL_PATH . '/video-slider' );
$this->set_base( 'neobeat_core_video_slider' );
$this->set_name( esc_html__( 'Video Slider', 'neobeat-core' ) );
$this->set_description( esc_html__( 'Shortcode that adds video slider element', 'neobeat-core' ) );
$this->set_category( esc_html__( 'NeoBeat Core', 'neobeat-core' ) );
$this->set_option( array(
'field_type' => 'text',
'name' => 'custom_class',
'title' => esc_html__( 'Custom Class', 'neobeat-core' ),
) );
$this->set_option( array(
'field_type' => 'repeater',
'name' => 'children',
'title' => esc_html__( 'Child elements', 'neobeat-core' ),
'items' => array(
array(
'field_type' => 'text',
'name' => 'video_link',
'title' => esc_html__( 'Video Link', 'neobeat-core' ),
'default_value' => ''
),
array(
'field_type' => 'image',
'name' => 'video_image',
'title' => esc_html__( 'Video Image', 'neobeat-core' )
)
)
) );
$this->map_extra_options();
}
public function render( $options, $content = null ) {
parent::render( $options );
$atts = $this->get_atts();
$atts['holder_classes'] = $this->get_holder_classes( $atts );
$atts['slider_attr'] = $this->get_slider_data();
$atts['items'] = $this->parse_repeater_items( $atts['children'] );
$atts['this_shortcode'] = $this;
return neobeat_core_get_template_part( 'shortcodes/video-slider', 'templates/video-slider', '', $atts );
}
private function get_holder_classes() {
$holder_classes = $this->init_holder_classes();
$holder_classes[] = 'qodef-video-slider qodef-swiper-container';
return implode( ' ', $holder_classes );
}
private function get_slider_data() {
$data = array();
$data['slidesPerView'] = 'auto';
$data['centeredSlides'] = 'true';
$data['speed'] = '5000';
return json_encode( $data );
}
}
}