if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
if( ! Avia_Config_LayerSlider()->is_active() )
{
return;
}
if ( ! class_exists( 'avia_sc_layerslider' ) )
{
class avia_sc_layerslider extends aviaShortcodeTemplate
{
static $slide_count = 0;
/**
* Create the config array for the shortcode button
*/
public function shortcode_insert_button()
{
$this->config['self_closing'] = 'yes';
$this->config['forced_load_objects'] = array('layerslider'); // Lnea corregida
$this->config['name'] = __('Advanced Layerslider', 'avia_framework');
$this->config['tab'] = __('Media Elements', 'avia_framework');
$this->config['icon'] = AviaBuilder::$path['imagesURL'] . "sc-slideshow-layer.png";
$this->config['order'] = 10;
$this->config['target'] = 'avia-target-insert';
$this->config['shortcode']= 'av_layerslider';
$this->config['tooltip'] = __('Display a Layerslider Slideshow', 'avia_framework');
$this->config['tinyMCE'] = array('disable' => "true");
$this->config['drag-level'] = 1;
}
function extra_assets()
{
//load css
wp_enqueue_style( 'avia-module-slideshow-ls' , AviaBuilder::$path['pluginUrlRoot'].'avia-shortcodes/slideshow_layerslider/slideshow_layerslider.css' , array('avia-layout'), false );
//load js
wp_enqueue_script( 'avia-module-slideshow-ls' , AviaBuilder::$path['pluginUrlRoot'].'avia-shortcodes/slideshow_layerslider/slideshow_layerslider.js' , array('avia-shortcodes'), false, TRUE );
}
/**
* Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
* Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
* Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
*
*
* @param array $params this array holds the default values for $content and $args.
* @return $params the return array usually holds an innerHtml key that holds item specific markup.
*/
public function editor_element($params)
{
//fetch all registered slides and save them to the slides array
$slides = Avia_Config_LayerSlider()->find_layersliders( true );
if(empty($params['args']['id']) && is_array($slides)) $params['args']['id'] = reset($slides);
if(empty($params['args']['id'])) $params['args']['id'] = "";
$element = array(
'subtype' => $slides,
'type'=>'select',
'std' => $params['args']['id'],
'class' => 'avia-recalc-shortcode',
'data' => array('attr'=>'id')
);
$inner = "";
if(empty($slides))
{
$inner.= "