cipher87

popup-templates.class

Sep 5th, 2020
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 86.74 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Class defines option templates for ALB elements
  4.  * These templates replace an element in the options array.
  5.  * Nested templates are supported.
  6.  *
  7.  * Basic structure, not all arguments are supported by every template element (example):
  8.  *
  9.  *          array( 
  10.  *                      'type'                  => 'template',
  11.  *                      'template_id'           => 'date_query',
  12.  *                      'required'              => ! isset() | array()     //   used for all elements
  13.  *                      'template_required'     => array(
  14.  *                                                      0   => array( 'slide_type', 'is_empty_or', 'entry-based' )
  15.  *                                                  ),
  16.  *                      'content'               => ! isset() | array( array of elements - can be templates also )
  17.  *                      'templates_include'     => ! isset() | array( list of needed subtemplates ),
  18.  *                      'subtype'               => mixed                    //  allows to change subtype e.g. for select boxes
  19.  *                      'args'                  => mixed                    //  e.g. shortcode class
  20.  *                                                 
  21.  *                  ),
  22.  *
  23.  * Also allows to store HTML code snippets (can be used in editor elements like e.g. 'element streches/fullwidth').
  24.  *
  25.  * @added_by Günter
  26.  * @since 4.5.7.1
  27.  * @since 4.6.4         supports dynamic added templates
  28.  */
  29.  
  30. if ( ! defined( 'ABSPATH' ) ) {  exit;  }    // Exit if accessed directly
  31.  
  32. if( ! class_exists( 'Avia_Popup_Templates' ) )
  33. {
  34.    
  35.     class Avia_Popup_Templates
  36.     {
  37.        
  38.         /**
  39.          * Holds the instance of this class
  40.          *
  41.          * @since 4.5.7.1
  42.          * @var Avia_Popup_Templates
  43.          */
  44.         static private $_instance = null;
  45.        
  46.         /**
  47.          * Array of dynamic templates added on the fly
  48.          *      template_id  =>  array();
  49.          *
  50.          * @since 4.6.4
  51.          * @var array
  52.          */
  53.         protected $dynamic_templates;
  54.        
  55.         /**
  56.          * Array of HTML codesnippets
  57.          *
  58.          * @since 4.6.4
  59.          * @var array
  60.          */
  61.         protected $html_templates;
  62.  
  63.  
  64.         /**
  65.          * Return the instance of this class
  66.          *
  67.          * @since 4.5.7.1
  68.          * @return Avia_Popup_Templates
  69.          */
  70.         static public function instance()
  71.         {
  72.             if( is_null( Avia_Popup_Templates::$_instance ) )
  73.             {
  74.                 Avia_Popup_Templates::$_instance = new Avia_Popup_Templates();
  75.             }
  76.            
  77.             return Avia_Popup_Templates::$_instance;
  78.         }
  79.        
  80.         /**
  81.          * @since 4.5.7.1
  82.          */
  83.         protected function __construct()
  84.         {
  85.             $this->dynamic_templates = array();
  86.             $this->html_templates = array();
  87.            
  88.             $this->set_predefined_html_templates();
  89.            
  90.             /**
  91.              * Allow 3-rd party to register own templates
  92.              *
  93.              * @since 4.6.4
  94.              * @param Avia_Popup_Templates $this
  95.              */
  96.             do_action( 'ava_popup_register_dynamic_templates', $this );
  97.         }
  98.        
  99.         /**
  100.          * @since 4.6.4
  101.          */
  102.         public function __destruct()
  103.         {
  104.             unset( $this->dynamic_templates );
  105.             unset( $this->html_templates );
  106.         }
  107.        
  108.         /**
  109.          * Main entry function:
  110.          * ====================
  111.          *
  112.          * Replaces predefined templates for easier maintainnance of code
  113.          * Recursive function. Also supports nested templates.
  114.          *
  115.          * @since 4.5.6.1
  116.          * @param array $elements
  117.          * @return array
  118.          */
  119.         public function replace_templates( array $elements )
  120.         {
  121.             if( empty( $elements ) )
  122.             {
  123.                 return $elements;
  124.             }
  125.            
  126.             $start_check = true;
  127.            
  128.             while( $start_check )
  129.             {
  130.                 $offset = 0;
  131.                 foreach( $elements as $key => $element )
  132.                 {
  133.                     if( isset( $element['subelements'] ) )
  134.                     {
  135.                         $elements[ $key ]['subelements'] = $this->replace_templates( $element['subelements'] );
  136.                     }
  137.                    
  138.                     if( ! isset( $element['type'] ) || $element['type'] != 'template' )
  139.                     {
  140.                         $offset++;
  141.                         if( $offset >= count( $elements ) )
  142.                         {
  143.                             $start_check = false;
  144.                             break;
  145.                         }
  146.                         continue;
  147.                     }
  148.  
  149.                     $replace = $this->get_template( $element );
  150.                     if( false === $replace )
  151.                     {
  152.                         $offset++;
  153.                         if( $offset >= count( $elements ) )
  154.                         {
  155.                             $start_check = false;
  156.                             break;
  157.                         }
  158.                         continue;
  159.                     }
  160.  
  161.                     array_splice( $elements, $offset, 1, $replace );
  162.                     break;
  163.                 }
  164.             }
  165.            
  166.             return $elements;
  167.         }
  168.  
  169.         /**
  170.          * Returns the array elements to replace the template array element.
  171.          * Dynamic templates override predefined.
  172.          *
  173.          * @since 4.5.6.1
  174.          * @param array $element
  175.          * @param boolean
  176.          * @return array|false
  177.          */
  178.         protected function get_template( array $element, $parent = false )
  179.         {
  180.             if( ! isset( $element['template_id'] ) )
  181.             {
  182.                 return false;
  183.             }
  184.            
  185.             if( array_key_exists( $element['template_id'], $this->dynamic_templates ) )
  186.             {
  187.                 if( $parent === false || ! method_exists( $this, $element['template_id'] ) )
  188.                 {
  189.                     $result = $this->get_dynamic_template( $element );
  190.                     return $result;
  191.                 }
  192.             }
  193.            
  194.             if( ! method_exists( $this, $element['template_id'] ) )
  195.             {
  196.                 return false;
  197.             }
  198.            
  199.             $result = call_user_func_array( array( $this, $element['template_id'] ), array( $element ) );
  200.             return $result;
  201.         }
  202.        
  203.         /**
  204.          * Returns if a template exists
  205.          *
  206.          * @since 4.6.4
  207.          * @param string $template_id
  208.          * @return string|false             false | 'predefined' | 'dynamic' | 'dynamic and fixed'
  209.          */
  210.         public function template_exists( $template_id )
  211.         {
  212.             $exist = false;
  213.            
  214.             if( array_key_exists( $template_id, $this->dynamic_templates ) )
  215.             {
  216.                 $exist = 'dynamic';
  217.             }
  218.            
  219.             if( method_exists( $this, $template_id ) )
  220.             {
  221.                 $exist = false === $exist ? 'predefined' : 'dynamic and predefined';
  222.             }
  223.            
  224.             return $exist;
  225.         }
  226.  
  227.         /**
  228.          * Add a dynamic template
  229.          *
  230.          * @since 4.6.4
  231.          * @param string $template_id
  232.          * @param array $template_data
  233.          * @param boolean $ignore_debug_notice
  234.          */
  235.         public function register_dynamic_template( $template_id, array $template_data, $ignore_debug_notice = false )
  236.         {
  237.             if( defined( 'WP_DEBUG' ) && WP_DEBUG && false === $ignore_debug_notice )
  238.             {
  239.                 $exist = $this->template_exists( $template_id );
  240.                 if( false !== $exist )
  241.                 {
  242.                     error_log( sprintf( __( 'Already existing template %1$s is overwritten (%2$s). Make sure this is intended.', 'avia_framework' ), $template_id, $exist )  );
  243.                 }
  244.             }
  245.            
  246.             $this->dynamic_templates[ $template_id ] = $template_data;
  247.         }
  248.        
  249.         /**
  250.          * Adds a template to the list of available templates.
  251.          *
  252.          * @since 4.6.4
  253.          * @param string $template_id
  254.          * @param mixed $template_data
  255.          * @param boolean $overwrite
  256.          * @return boolean
  257.          */
  258.         public function register_html_template( $template_id, $template_data, $overwrite = false )
  259.         {
  260.             if( array_key_exists( $template_id, $this->html_templates ) && ( false === $overwrite ) )
  261.             {
  262.                 return false;
  263.             }
  264.            
  265.             $this->html_templates[ $template_id ] = $template_data;
  266.             return true;
  267.         }
  268.        
  269.         /**
  270.          * Returns the stored content. If template does not exist '' is returned.
  271.          *
  272.          * @since 4.6.4
  273.          * @param string $template_id
  274.          * @return string
  275.          */
  276.         public function get_html_template( $template_id )
  277.         {
  278.             return isset( $this->html_templates[ $template_id ] ) ? $this->html_templates[ $template_id ] : '';
  279.         }
  280.  
  281.         /**
  282.          * Removes a registered dynamic template
  283.          *
  284.          * @since 4.6.4
  285.          * @param string $template_id
  286.          * @return boolean
  287.          */
  288.         public function deregister_dynamic_template( $template_id )
  289.         {
  290.             if( ! isset( $this->dynamic_templates[ $template_id ] ) )
  291.             {
  292.                 return false;
  293.             }
  294.            
  295.             unset( $this->dynamic_templates[ $template_id ] );
  296.             return true;
  297.         }
  298.  
  299.         /**
  300.          * Return content of template.
  301.          *
  302.          * if 'templates_include'   => add content of all templates
  303.          *
  304.          * @since 4.6.4
  305.          * @param array $element
  306.          * @return array|false
  307.          */
  308.         protected function get_dynamic_template( array $element )
  309.         {
  310.             $template_content = $this->dynamic_templates[ $element['template_id'] ];
  311.            
  312.             $result = $this->get_templates_to_include( $template_content, $element );
  313.             if( false !== $result )
  314.             {
  315.                 return $result;
  316.             }
  317.            
  318.             return $template_content;
  319.         }
  320.        
  321.         /**
  322.          * Returns all templates to include
  323.          *
  324.          * @since 4.6.4
  325.          * @param array $template
  326.          * @param array|null $parent_template
  327.          * @return array|false
  328.          */
  329.         protected function get_templates_to_include( array $template, $parent_template = null )
  330.         {
  331.             if( empty( $template['templates_include'] ) )
  332.             {
  333.                 return false;
  334.             }
  335.            
  336.             $attr = is_null( $parent_template ) ? $template : $parent_template;
  337.             unset( $attr['template_id'] );
  338.             unset( $attr['templates_include'] );
  339.            
  340.             $result = array();
  341.                    
  342.             foreach( $template['templates_include'] as $sub_template )
  343.             {
  344.                 if( false !== $this->template_exists( $sub_template ) )
  345.                 {
  346.                     $temp = array( 
  347.                                     'template_id'   => $sub_template,
  348.                                 );     
  349.                    
  350.                     foreach( $attr as $key => $value )
  351.                     {
  352.                         $temp[ $key ] = $value;
  353.                     }
  354.                    
  355.                     $result[] = $temp;
  356.                 }
  357.             }
  358.            
  359.             return $result;
  360.         }
  361.        
  362.         /**
  363.          * Returns a toggle container section.
  364.          * Content is filled from
  365.          *      - 'content'
  366.          *      - 'templates_include'
  367.          *
  368.          * @since 4.6.4
  369.          * @param array $element
  370.          * @return array|false
  371.          */
  372.         protected function toggle_container( array $element )
  373.         {
  374.             $title = ! empty( $element['title'] ) ? $element['title'] : __( 'Click to view content', 'avia_framework' );
  375.             $open = array(
  376.                         'type'          => 'toggle_container',
  377.                         'nodescription' => true
  378.                     );
  379.            
  380.             $close = array(
  381.                         'type'          => 'toggle_container_close',
  382.                         'nodescription' => true
  383.                     );
  384.            
  385.             $content = false;
  386.             if( ! empty( $element['content'] ) )
  387.             {
  388.                 $content = $element['content'];
  389.             }
  390.             else if( ! empty( $element['templates_include'] ) )
  391.             {
  392.                 $content = $this->get_templates_to_include( $element );
  393.             }
  394.            
  395.             if( empty( $content ) )
  396.             {
  397.                 return false;
  398.             }
  399.            
  400.             $result = array_merge( array( $open ), $content, array( $close ) );
  401.             return $result;
  402.         }
  403.        
  404.         /**
  405.          * Returns a toggle section.
  406.          * Content is filled from
  407.          *      - 'content'
  408.          *      - 'templates_include'
  409.          *
  410.          * @since 4.6.4
  411.          * @param array $element
  412.          * @return array|false
  413.          */
  414.         protected function toggle( array $element )
  415.         {
  416.             $title = ! empty( $element['title'] ) ? $element['title'] : __( 'Click to view content', 'avia_framework' );
  417.             $class = ! empty( $element['container_class'] ) ? $element['container_class'] : '';
  418.            
  419.             $required = ! empty( $element['required'] ) ? $element['required'] : array();
  420.            
  421.             $open = array(
  422.                         'type'          => 'toggle',
  423.                         'name'          => $title,
  424.                         'nodescription' => true,
  425.                         'container_class'   => $class,
  426.                         'required'      => $required
  427.                     );
  428.            
  429.             $close = array(
  430.                         'type'          => 'toggle_close',
  431.                         'nodescription' => true,
  432.                     );
  433.            
  434.             $content = false;
  435.             if( ! empty( $element['content'] ) )
  436.             {
  437.                 $content = $element['content'];
  438.             }
  439.             else if( ! empty( $element['templates_include'] ) )
  440.             {
  441.                 $content = $this->get_templates_to_include( $element );
  442.             }
  443.            
  444.             if( empty( $content ) )
  445.             {
  446.                 return false;
  447.             }
  448.            
  449.             $result = array_merge( array( $open ), $content, array( $close ) );
  450.             return $result;
  451.         }
  452.        
  453.         /**
  454.          * Returns a font sizes icon switcher section.
  455.          *
  456.          * @since 4.6.4
  457.          * @param array $element
  458.          * @return array
  459.          */
  460.         protected function font_sizes_icon_switcher( array $element )
  461.         {
  462.            
  463.             if( isset( $element['subtype'] ) && is_array( $element['subtype'] ) )
  464.             {
  465.                 $subtype = $element['subtype'];
  466.             }
  467.             else
  468.             {
  469.                 $subtype = array(
  470.                             'default'   => AviaHtmlHelper::number_array( 8, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  471.                             'medium'    => AviaHtmlHelper::number_array( 8, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  472.                             'small'     => AviaHtmlHelper::number_array( 8, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  473.                             'mini'      => AviaHtmlHelper::number_array( 8, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  474.                         );
  475.             }
  476.            
  477.             if( isset( $element['id_sizes'] ) && is_array( $element['id_sizes'] ) )
  478.             {
  479.                 $id_sizes = $element['id_sizes'];
  480.             }
  481.             else
  482.             {
  483.                 $id_sizes = array(
  484.                             'default'   => 'size',
  485.                             'medium'    => 'av-medium-font-size',
  486.                             'small'     => 'av-small-font-size',
  487.                             'mini'      => 'av-mini-font-size'
  488.                         );
  489.             }
  490.            
  491.             if( isset( $element['desc_sizes'] ) && is_array( $element['desc_sizes'] ) )
  492.             {
  493.                 $desc_sizes = $element['desc_sizes'];
  494.             }
  495.             else
  496.             {
  497.                 $desc_sizes = array(
  498.                             'default'   => __( 'Font Size (Default)', 'avia_framework' ),
  499.                             'medium'    => __( 'Font Size for medium sized screens (between 768px and 989px - eg: Tablet Landscape)', 'avia_framework' ),
  500.                             'small'     => __( 'Font Size for small screens (between 480px and 767px - eg: Tablet Portrait)', 'avia_framework' ),
  501.                             'mini'      => __( 'Font Size for very small screens (smaller than 479px - eg: Smartphone Portrait)', 'avia_framework' ),
  502.                         );
  503.             }
  504.            
  505.             $titles = array(
  506.                             'default'   => __( 'Default', 'avia_framework' ),
  507.                             'medium'    => __( 'Tablet Landscape', 'avia_framework' ),
  508.                             'small'     => __( 'Tablet Portrait', 'avia_framework' ),
  509.                             'mini'      => __( 'Mobile', 'avia_framework' ),
  510.                         );
  511.            
  512.             $icons = array(
  513.                             'default'   => 'desktop',
  514.                             'medium'    => 'tablet-landscape',
  515.                             'small'     => 'tablet-portrait',
  516.                             'mini'      => 'mobile'
  517.                         );
  518.            
  519.            
  520.            
  521.             $template = array(
  522.                             array(
  523.                                 'type'  => 'icon_switcher_container',
  524.                                 'name'  => ! empty( $element['name'] ) ? $element['name'] : '',
  525.                                 'desc'  => ! empty( $element['desc'] ) ? $element['desc'] : '',
  526. //                              'icon'  => __( 'Content', 'avia_framework' ),
  527.                                 'nodescription' => true,
  528.                                 'required'  => isset( $element['required'] ) ? $element['required'] : array()
  529.                             ), 
  530.                        
  531.                         );
  532.            
  533.             foreach( $id_sizes as $size => $id )
  534.             {
  535.                 $template[] = array(
  536.                                 'type'  => 'icon_switcher',
  537.                                 'name'  => $titles[ $size ],
  538.                                 'icon'  => $icons[ $size ],
  539.                                 'nodescription' => true
  540.                             );
  541.                
  542.                 $template[] = array(   
  543.                                 'name'  => $desc_sizes[ $size ],
  544.                                 'desc'  => __( 'Size of the text in px', 'avia_framework' ),
  545.                                 'id'    => $id_sizes[ $size],
  546.                                 'type'  => 'select',
  547.                                 'subtype'   => $subtype[ $size],
  548.                                 'std'   => ''
  549.                             );
  550.                
  551.                 $template[] = array(
  552.                                 'type'  => 'icon_switcher_close',
  553.                                 'nodescription' => true
  554.                         );
  555.             }
  556.            
  557.             $template[] = array(
  558.                                 'type'  => 'icon_switcher_container_close',
  559.                                 'nodescription' => true
  560.                             );
  561.            
  562.             return $template;
  563.         }
  564.        
  565.         /**
  566.          * Returns a columns count icon switcher section.
  567.          *
  568.          * @since 4.6.4
  569.          * @param array $element
  570.          * @return array
  571.          */
  572.         protected function columns_count_icon_switcher( array $element )
  573.         {
  574.             if( isset( $element['heading'] ) && is_array( $element['heading'] ) )
  575.             {
  576.                 $heading = $element['heading'];
  577.             }
  578.             else
  579.             {
  580.                 $info  = __( 'Set the column count for this element, based on the device screensize.', 'avia_framework' ) . '<br/><small>';
  581.                 $info .= __( 'Please note that changing the default will overwrite any individual &quot;landscape&quot; width settings. Each item will have the same width', 'avia_framework' ) . '</small>';
  582.                
  583.                 $heading = array(
  584.                                 'name'  => __( 'Element Columns', 'avia_framework' ),
  585.                                 'desc'  => $info,
  586.                                 'type'  => 'heading',
  587.                                 'description_class' => 'av-builder-note av-neutral',
  588.                             );
  589.             }
  590.            
  591.             if( isset( $element['subtype'] ) && is_array( $element['subtype'] ) )
  592.             {
  593.                 $subtype = $element['subtype'];
  594.             }
  595.             else
  596.             {
  597.                 $responsive = array(
  598.                                     __( 'Use Default', 'avia_framework' )   => '',
  599.                                     __( '1 Column', 'avia_framework' )      => '1',
  600.                                     __( '2 Columns', 'avia_framework' )     => '2',
  601.                                     __( '3 Columns', 'avia_framework' )     => '3',
  602.                                     __( '4 Columns', 'avia_framework' )     => '4'
  603.                                 );
  604.                
  605.                 $subtype = array(
  606.                             'default'   => array(
  607.                                                 __( 'Automatic, based on screen width', 'avia_framework' )  => 'flexible',
  608.                                                 __( '2 Columns', 'avia_framework' ) => '2',
  609.                                                 __( '3 Columns', 'avia_framework' ) => '3',
  610.                                                 __( '4 Columns', 'avia_framework' ) => '4',
  611.                                                 __( '5 Columns', 'avia_framework' ) => '5',
  612.                                                 __( '6 Columns', 'avia_framework' ) => '6'
  613.                                             ),
  614.                             'medium'    => $responsive,    
  615.                             'small'     => $responsive,
  616.                             'mini'      => $responsive
  617.                         );
  618.             }
  619.            
  620.             if( isset( $element['std'] ) && is_array( $element['std'] ) )
  621.             {
  622.                 $std = $element['std'];
  623.             }
  624.             else
  625.             {
  626.                 $std = array(
  627.                             'default'   => 'flexible',
  628.                             'medium'    => '',
  629.                             'small'     => '',
  630.                             'mini'      => ''
  631.                         );
  632.             }
  633.            
  634.             if( isset( $element['id_sizes'] ) && is_array( $element['id_sizes'] ) )
  635.             {
  636.                 $id_sizes = $element['id_sizes'];
  637.             }
  638.             else
  639.             {
  640.                 $id_sizes = array(
  641.                             'default'   => 'columns',
  642.                             'medium'    => 'av-medium-columns',
  643.                             'small'     => 'av-small-columns',
  644.                             'mini'      => 'av-mini-columns'
  645.                         );
  646.             }
  647.            
  648.             if( isset( $element['desc_sizes'] ) && is_array( $element['desc_sizes'] ) )
  649.             {
  650.                 $desc_sizes = $element['desc_sizes'];
  651.             }
  652.             else
  653.             {
  654.                 $desc_sizes = array(
  655.                             'default'   => __( 'Column count (Default)', 'avia_framework' ),
  656.                             'medium'    => __( 'Column count for medium sized screens (between 768px and 989px - eg: Tablet Landscape)', 'avia_framework' ),
  657.                             'small'     => __( 'Column count for small screens (between 480px and 767px - eg: Tablet Portrait)', 'avia_framework' ),
  658.                             'mini'      => __( 'Column count for very small screens (smaller than 479px - eg: Smartphone Portrait)', 'avia_framework' ),
  659.                         );
  660.             }
  661.            
  662.             $titles = array(
  663.                             'default'   => __( 'Default', 'avia_framework' ),
  664.                             'medium'    => __( 'Tablet Landscape', 'avia_framework' ),
  665.                             'small'     => __( 'Tablet Portrait', 'avia_framework' ),
  666.                             'mini'      => __( 'Mobile', 'avia_framework' ),
  667.                         );
  668.            
  669.             $icons = array(
  670.                             'default'   => 'desktop',
  671.                             'medium'    => 'tablet-landscape',
  672.                             'small'     => 'tablet-portrait',
  673.                             'mini'      => 'mobile'
  674.                         );
  675.            
  676.             $template = array();
  677.                            
  678.             if( ! empty( $heading ) )
  679.             {
  680.                 $template[] = $heading;
  681.             }
  682.            
  683.             $template[] = array(
  684.                                 'type'  => 'icon_switcher_container',
  685.                                 'name'  => ! empty( $element['name'] ) ? $element['name'] : '',
  686.                                 'desc'  => ! empty( $element['desc'] ) ? $element['desc'] : '',
  687. //                              'icon'  => __( 'Content', 'avia_framework' ),
  688.                                 'nodescription' => true,
  689.                                 'required'  => isset( $element['required'] ) ? $element['required'] : array()
  690.                             );
  691.            
  692.            
  693.             foreach( $id_sizes as $size => $id )
  694.             {
  695.                 $template[] = array(
  696.                                 'type'  => 'icon_switcher',
  697.                                 'name'  => $titles[ $size ],
  698.                                 'icon'  => $icons[ $size ],
  699.                                 'nodescription' => true
  700.                             );
  701.                
  702.                 $template[] = array(   
  703.                                 'name'  => $desc_sizes[ $size ],
  704.                                 'desc'  => __( 'How many columns do you want to use', 'avia_framework' ),
  705.                                 'id'    => $id_sizes[ $size ],
  706.                                 'type'  => 'select',
  707.                                 'subtype'   => $subtype[ $size ],
  708.                                 'std'   => $std[ $size ],
  709.                             );
  710.                
  711.                 $template[] = array(
  712.                                 'type'  => 'icon_switcher_close',
  713.                                 'nodescription' => true
  714.                         );
  715.             }
  716.            
  717.             $template[] = array(
  718.                                 'type'  => 'icon_switcher_container_close',
  719.                                 'nodescription' => true
  720.                             );
  721.            
  722.             return $template;
  723.         }
  724.        
  725.         /**
  726.          * Returns a screen options toggle section.
  727.          *
  728.          * @since 4.6.4
  729.          * @param array $element
  730.          * @return array
  731.          */
  732.         protected function screen_options_toggle( array $element )
  733.         {
  734.  
  735.             $screen = $this->screen_options_tab( $element, false );
  736.            
  737.             $template = array(
  738.                             array(
  739.                                 'type'          => 'template',
  740.                                 'template_id'   => 'toggle',
  741.                                 'title'         => __( 'Responsive', 'avia_framework' ),
  742.                                 'content'       => $screen,
  743.                                 'nodescription' => true
  744.                             )
  745.                         );
  746.            
  747.             return $template;
  748.         }
  749.        
  750.         /**
  751.          * Returns a screen options toggle for columns.
  752.          *
  753.          * @since 4.6.4
  754.          * @param array $element
  755.          * @return array
  756.          */
  757.         protected function columns_visibility_toggle( array $element )
  758.         {
  759.             $desc  = __( 'Set the visibility for this element, based on the device screensize.', 'avia_framework' ) . '<br><small>';
  760.             $desc .= __( 'In order to prevent breaking the layout it is only possible to change the visibility settings for columns once they take up the full screen width, which means only on mobile devices', 'avia_framework' ) . '</small>';
  761.  
  762.             $c = array(
  763.                        
  764.                         array(
  765.                             'name'  => __( 'Element Visibility', 'avia_framework' ),
  766.                             'desc'  => $desc,
  767.                             'type'  => 'heading',
  768.                             'description_class' => 'av-builder-note av-neutral',
  769.                         ),
  770.                                
  771.                         array( 
  772.                             'name'  => __( 'Mobile display', 'avia_framework' ),
  773.                             'desc'  => __( 'Display settings for this element when viewed on smaller screens', 'avia_framework' ),
  774.                             'id'    => 'mobile_display',
  775.                             'type'  => 'select',
  776.                             'std'   => '',
  777.                             'subtype' => array(
  778.                                             __( 'Always display', 'avia_framework' )            => '',
  779.                                             __( 'Hide on mobile devices', 'avia_framework' )    => 'av-hide-on-mobile',
  780.                                         )
  781.                         )
  782.                 );
  783.            
  784.             $template = array(
  785.                             array( 
  786.                                 'type'          => 'template',
  787.                                 'template_id'   => 'toggle',
  788.                                 'title'         => __( 'Responsive', 'avia_framework' ),
  789.                                 'content'       => $c
  790.                             ),
  791.                     );
  792.            
  793.             return $template;
  794.         }
  795.        
  796.        
  797.        
  798.         /**
  799.          * Returns a developer options toggle section.
  800.          *
  801.          * @since 4.6.4
  802.          * @param array $element
  803.          * @return array
  804.          */
  805.         protected function developer_options_toggle( array $element )
  806.         {
  807.             $dev = array();
  808.             $shortcode = isset( $element['args']['sc'] ) && $element['args']['sc'] instanceof aviaShortcodeTemplate ? $element['args']['sc'] : null;
  809.             if( is_null( $shortcode ) )
  810.             {
  811.                 return $dev;
  812.             }
  813.            
  814.             $nested = isset( $element['args']['nested'] ) ? $element['args']['nested'] : '';
  815.             $visible = $shortcode->get_developer_elements( $dev, $nested );
  816.             if( empty( $dev ) )
  817.             {
  818.                 return $dev;
  819.             }
  820.            
  821.             $template = array(
  822.                             array(
  823.                                 'type'          => 'template',
  824.                                 'template_id'   => 'toggle',
  825.                                 'title'         => __( 'Developer Settings', 'avia_framework' ),
  826.                                 'content'       => $dev,
  827.                                 'nodescription' => true,
  828.                                 'container_class'   => $visible
  829.                             )
  830.                         );
  831.            
  832.             return $template;
  833.         }
  834.        
  835.         /**
  836.          * Element Disabled In Performance Tab Template
  837.          *
  838.          * @since 4.6.4
  839.          * @param array $element
  840.          * @return array
  841.          */
  842.         protected function element_disabled( array $element )
  843.         {
  844.             $default = __( 'This element is disabled in your theme options. You can enable it in Enfold &raquo; Performance', 'avia_framework' );
  845.             $anchor = ! empty( $element['args']['anchor'] ) ? trim( $element['args']['anchor'] ) : 'goto_performance';
  846.            
  847.             $desc  = ! empty( $element['args']['desc'] ) ? trim( $element['args']['desc'] ) : $default;
  848.             $desc .= '<br/><br/><a target="_blank" href="' . admin_url( 'admin.php?page=avia#' . $anchor ) . '">' . __( 'Enable it here', 'avia_framework' ) . '</a><br/><br/>';
  849.            
  850.             $template = array(
  851.                             array(
  852.                                 'name'  => __( 'Element disabled', 'avia_framework' ),
  853.                                 'desc'  => $desc,
  854.                                 'type'  => 'heading',
  855.                                 'description_class' => 'av-builder-note av-error',
  856.                             )
  857.                        
  858.                 );
  859.            
  860.             return $template;
  861.         }
  862.        
  863.        
  864.        
  865.         /**
  866.          * Video Template
  867.          *
  868.          * @since 4.6.4
  869.          * @param array $element
  870.          * @return array
  871.          */
  872.         protected function avia_builder_post_type_option( array $element )
  873.         {
  874.             $desc = __( "Select which post types should be used. Note that your taxonomy will be ignored if you do not select an assign post type. If yo don't select post type all registered post types will be used", 'avia_framework' );
  875.  
  876.             $required = isset( $element['required'] ) && is_array( $element['required'] ) ? $element['required'] : array();
  877.            
  878.             $template = array(
  879.                             array(
  880.                                 'name'  => __( 'Select Post Type', 'avia_framework' ),
  881.                                 'desc'  => $desc,
  882.                                 'id'    => 'post_type',
  883.                                 'type'  => 'select',
  884.                                 'std'   => '',
  885.                                 'multiple'  => 6,
  886.                                 'required'  => $required,
  887.                                 'subtype'   => AviaHtmlHelper::get_registered_post_type_array()
  888.                             )
  889.                 );
  890.            
  891.             return $template;
  892.         }
  893.        
  894.        
  895.         /**
  896.          * Linkpicker Template
  897.          *
  898.          * @since 4.6.4
  899.          * @param array $element
  900.          * @return array
  901.          */
  902.         protected function linkpicker_toggle( array $element )
  903.         {
  904.             $id = isset( $element['id'] ) ? $element['id'] : 'link';
  905.             $name = ! empty( $element['name'] ) ? $element['name'] : __( 'Text Link?', 'avia_framework' );
  906.             $desc = ! empty( $element['desc'] ) ? $element['desc'] : __( 'Apply  a link to the text?', 'avia_framework' );
  907.             $std = ! empty( $element['std'] ) ? $element['std'] : '';
  908.             $required = ! empty( $element['required'] ) ? $element['required'] : array();
  909.             $link_required = ! empty( $element['link_required'] ) ? $element['link_required'] : array( $id, 'not', '' );
  910.             $target_id = isset( $element['target_id'] ) ? $element['target_id'] : 'linktarget';
  911.             $target_std = isset( $element['target_std'] ) ? $element['target_std'] : '';
  912.            
  913.             $subtype = array();
  914.             if( isset( $element['subtype'] ) && is_array( $element['subtype'] ) )
  915.             {
  916.                 $subtype = $element['subtype'];
  917.             }
  918.             else
  919.             {
  920.                 $subtype_keys = ! empty( $element['subtypes'] ) ? $element['subtypes'] : array( 'no', 'manually', 'single', 'taxonomy' );
  921.            
  922.                 foreach( $subtype_keys as $key )
  923.                 {
  924.                     switch( $key )
  925.                     {
  926.                         case 'no':
  927.                             $subtype[ __( 'No Link', 'avia_framework' ) ] = '';
  928.                             break;
  929.                         case 'default':
  930.                             $subtype[ __( 'Use Default Link', 'avia_framework' ) ] = 'default';
  931.                             break;
  932.                         case 'manually':
  933.                             $subtype[ __( 'Set Manually', 'avia_framework' ) ] = 'manually';
  934.                             break;
  935.                         case 'single':
  936.                             $subtype[ __( 'Single Entry', 'avia_framework' ) ] = 'single';
  937.                             break;
  938.                         case 'taxonomy':
  939.                             $subtype[ __( 'Taxonomy Overview Page', 'avia_framework' ) ] = 'taxonomy';
  940.                             break;
  941.                         case 'lightbox':
  942.                             $subtype[ __( 'Open in Lightbox', 'avia_framework' ) ] = 'lightbox';
  943.                             break;
  944.                         default:
  945.                             break;
  946.                     }
  947.                 }
  948.             }
  949.            
  950.             $c = array(
  951.                         array(
  952.                             'name'      => $name,
  953.                             'desc'      => $desc,
  954.                             'id'        => $id,
  955.                             'type'      => 'linkpicker',
  956.                             'std'       => $std,
  957.                             'fetchTMPL' => true,
  958.                             'required'  => $required,
  959.                             'subtype'   => $subtype
  960.                         )
  961.                 );
  962.            
  963.             if( ! isset( $element['no_target'] ) || true !== $element['no_target'] )
  964.             {
  965.                 $c[] = array(
  966.                             'name'  => __( 'Open in new window', 'avia_framework' ),
  967.                             'desc'  => __( 'Do you want to open the link in a new window', 'avia_framework' ),
  968.                             'id'    => $target_id,
  969.                             'type'  => 'select',
  970.                             'std'   => $target_std,
  971.                             'required'  => $link_required,
  972.                             'subtype'   => AviaHtmlHelper::linking_options()
  973.                         );
  974.             }
  975.            
  976.             if( isset( $element['no_toggle'] ) && true === $element['no_toggle'] )
  977.             {
  978.                 $template = $c;
  979.             }
  980.             else
  981.             {
  982.                 $template = array(
  983.                                 array( 
  984.                                     'type'          => 'template',
  985.                                     'template_id'   => 'toggle',
  986.                                     'title'         => __( 'Link Settings', 'avia_framework' ),
  987.                                     'content'       => $c
  988.                                 ),
  989.                     );
  990.             }
  991.            
  992.             return $template;
  993.         }
  994.        
  995.        
  996.         /**
  997.          * Video Template
  998.          *
  999.          * @since 4.6.4
  1000.          * @param array $element
  1001.          * @return array
  1002.          */
  1003.         protected function video( array $element )
  1004.         {
  1005.             $text = '';
  1006.            
  1007.             //if self hosted is disabled
  1008.             if( avia_get_option( 'disable_mediaelement' ) == 'disable_mediaelement' )
  1009.             {
  1010.                 $text = __( 'Please link to an external video by URL', 'avia_framework' ) . '<br/><br/>' .
  1011.                         __( 'A list of all supported Video Services can be found on', 'avia_framework' ) .
  1012.                         " <a target='_blank' href='http://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F'>WordPress.org</a>. Youtube videos will display additional info like title, share link, related videos, ...<br/><br/>" .
  1013.                         __( 'Working examples:', 'avia_framework' ) . '<br/>' .
  1014.                         '<strong>https://vimeo.com/1084537</strong><br/>' .
  1015.                         '<strong>https://www.youtube.com/watch?v=G0k3kHtyoqc</strong><br/><br/>'.
  1016.                         '<strong class="av-builder-note">' . __( 'Using self hosted videos is currently disabled. You can enable it in Enfold &raquo; Performance', 'avia_framework' ) . '</strong><br/>';
  1017.  
  1018.             }
  1019.             //if youtube/vimeo is disabled
  1020.             else if( avia_get_option( 'disable_video' ) == 'disable_video' )
  1021.             {
  1022.                 $text = __( 'Either upload a new video or choose an existing video from your media library', 'avia_framework' ) . '<br/><br/>'.
  1023.                         __( 'Different Browsers support different file types (mp4, ogv, webm). If you embed an example.mp4 video the video player will automatically check if an example.ogv and example.webm video is available and display those versions in case its possible and necessary','avia_framework' ) . '<br/><br/><strong class="av-builder-note">' .
  1024.                         __( 'Using external services like Youtube or Vimeo is currently disabled. You can enable it in Enfold &raquo; Performance', 'avia_framework' ) . '</strong><br/>';
  1025.  
  1026.             }
  1027.             //all video enabled
  1028.             else
  1029.             {
  1030.                 $text = __( 'Either upload a new video, choose an existing video from your media library or link to a video by URL', 'avia_framework' ) . '<br/><br/>'.
  1031.                         __( 'A list of all supported Video Services can be found on', 'avia_framework' ).
  1032.                         " <a target='_blank' href='http://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F'>WordPress.org</a>. YouTube videos will display additional info like title, share link, related videos, ...<br/><br/>".
  1033.                         __( 'Working examples, in case you want to use an external service:', 'avia_framework' ) . '<br/>'.
  1034.                         '<strong>https://vimeo.com/1084537</strong><br/>' .
  1035.                         '<strong>https://www.youtube.com/watch?v=G0k3kHtyoqc</strong><br/><br/>' .
  1036.                         '<strong>'.__( 'Attention when using self hosted HTML 5 Videos', 'avia_framework' ) . ':</strong><br/>' .
  1037.                         __( 'Different Browsers support different file types (mp4, ogv, webm). If you embed an example.mp4 video the video player will automatically check if an example.ogv and example.webm video is available and display those versions in case its possible and necessary', 'avia_framework' ) . '<br/>';
  1038.             }
  1039.            
  1040.            
  1041.             $template = array();
  1042.             $id = ! empty( $element['id'] ) ? $element['id'] :'video';
  1043.             $required = ! empty( $element['required'] ) ? $element['required'] : array();
  1044.            
  1045.             $template[] = array(   
  1046.                                 'name'  => __( 'Choose Video', 'avia_framework' ),
  1047.                                 'desc'  => $text,
  1048.                                 'required'  => $required,
  1049.                                 'id'    => $id,
  1050.                                 'type'  => 'video',
  1051.                                 'title' => __( 'Select Video', 'avia_framework' ),
  1052.                                 'button'    => __( 'Use Video', 'avia_framework' ),
  1053.                                 'std'   => 'https://'
  1054.                             );
  1055.                        
  1056.             if( ! empty( $element['args']['html_5_urls'] ) )
  1057.             {
  1058.                 $desc = __( 'Either upload a new video, choose an existing video from your media library or link to a video by URL. If you want to make sure that all browser can display your video upload a mp4, an ogv and a webm version of your video.','avia_framework' );
  1059.  
  1060.                 for( $i = 1; $i <= 2; $i++ )
  1061.                 {
  1062.                     $element = $template[0];
  1063.                    
  1064.                     $element['id'] = "{$id}_{$i}";
  1065.                     $element['name'] =  __( 'Choose Another Video (HTML5 Only)', 'avia_framework' );
  1066.                     $element['desc'] = $desc;
  1067.                    
  1068.                     $template[] = $element;
  1069.                 }
  1070.             }
  1071.            
  1072.             return $template;
  1073.         }
  1074.        
  1075.         /**
  1076.          * Slideshow Video Player Settings Template
  1077.          *
  1078.          * @since 4.6.4
  1079.          * @param array $element
  1080.          * @return array
  1081.          */
  1082.         protected function slideshow_player( array $element )
  1083.         {
  1084.             $required = ! empty( $element['required'] ) ? $element['required'] : array();
  1085.            
  1086.             $template = array(
  1087.                             array( 
  1088.                                 'name'  => __( 'Disable Autoplay', 'avia_framework' ),
  1089.                                 'desc'  => __( 'Check if you want to disable video autoplay when this slide shows. Autoplayed videos will be muted by default.', 'avia_framework' ) ,
  1090.                                 'id'    => 'video_autoplay',
  1091.                                 'required'  => $required,
  1092.                                 'std'   => '',
  1093.                                 'type'  => 'checkbox'
  1094.                             ),
  1095.                
  1096.                             array( 
  1097.                                 'name'  => __( 'Hide Video Controls', 'avia_framework' ),
  1098.                                 'desc'  => __( 'Check if you want to hide the controls (works for youtube and self hosted videos)', 'avia_framework' ) ,
  1099.                                 'id'    => 'video_controls',
  1100.                                 'required'  => $required,
  1101.                                 'std'   => '',
  1102.                                 'type'  => 'checkbox'
  1103.                             ),
  1104.  
  1105.                             array( 
  1106.                                 'name'  => __( 'Mute Video Player', 'avia_framework' ),
  1107.                                 'desc'  => __( 'Check if you want to mute the video', 'avia_framework' ) ,
  1108.                                 'id'    => 'video_mute',
  1109.                                 'required'  => $required,
  1110.                                 'std'   => '',
  1111.                                 'type'  => 'checkbox'
  1112.                             ),
  1113.  
  1114.                             array( 
  1115.                                 'name'  => __( 'Loop Video Player', 'avia_framework' ),
  1116.                                 'desc'  => __( 'Check if you want to loop the video (instead of showing the next slide the video will play from the beginning again)', 'avia_framework' ) ,
  1117.                                 'id'    => 'video_loop',
  1118.                                 'required'  => $required,
  1119.                                 'std'   => '',
  1120.                                 'type'  => 'checkbox'
  1121.                             )
  1122.                 );
  1123.            
  1124.             return $template;
  1125.         }
  1126.        
  1127.         /**
  1128.          * Slideshow Fallback Image Template
  1129.          *
  1130.          * @since 4.6.4
  1131.          * @param array $element
  1132.          * @return array
  1133.          */
  1134.         protected function slideshow_fallback_image( array $element )
  1135.         {
  1136.            
  1137.             $template = array(
  1138.            
  1139.                             array( 
  1140.                                 'name'  => __( 'Choose a preview/fallback image', 'avia_framework' ),
  1141.                                 'desc'  => __( 'Either upload a new, or choose an existing image from your media library', 'avia_framework' ) . '<br/><small>' . __( "Video on most mobile devices can't be controlled properly with JavaScript, so you can upload a fallback image which will be displayed instead. This image is also used if lazy loading is active.", 'avia_framework' ) . '</small>',
  1142.                                 'id'    => 'mobile_image',
  1143.                                 'fetch' => 'id',
  1144.                                 'type'  => 'image',
  1145.                                 'required'  => array( 'slide_type', 'equals', 'video' ),
  1146.                                 'title' => __( 'Choose Image', 'avia_framework' ),
  1147.                                 'button'    => __( 'Choose Image','avia_framework' ),
  1148.                                 'std'   => ''
  1149.                             ),
  1150.                                    
  1151.                             array( 
  1152.                                 'name'  => __( 'Mobile Fallback Image Link', 'avia_framework' ),
  1153.                                 'desc'  => __( 'You can enter a link to a video on youtube or vimeo that will open in a lightbox when the fallback image is clicked by the user. Links to self hosted videos will be opened in a new browser window on your mobile device or tablet', 'avia_framework' ),
  1154.                                 'required'  => array( 'mobile_image', 'not', '' ),
  1155.                                 'id'    => 'fallback_link',
  1156.                                 'std'   => 'https://',
  1157.                                 'type'  => 'input',
  1158.                             )
  1159.                     );
  1160.            
  1161.             return $template;
  1162.         }
  1163.        
  1164.         /**
  1165.          * Slideshow Overlay Template
  1166.          *
  1167.          * @since 4.6.4
  1168.          * @param array $element
  1169.          * @return array
  1170.          */
  1171.         protected function slideshow_overlay( array $element )
  1172.         {
  1173.            
  1174.             $template = array(
  1175.                             array( 
  1176.                                 'name'  => __( 'Enable Overlay?', 'avia_framework' ),
  1177.                                 'desc'  => __( 'Check if you want to display a transparent color and/or pattern overlay above your slideshow image/video', 'avia_framework' ),
  1178.                                 'id'    => 'overlay_enable',
  1179.                                 'std'   => '',
  1180.                                 'type'  => 'checkbox'
  1181.                             ),
  1182.  
  1183.                             array(
  1184.                                 'name'  => __( 'Overlay Opacity', 'avia_framework' ),
  1185.                                 'desc'  => __( 'Set the opacity of your overlay: 0.1 is barely visible, 1.0 is opaque ', 'avia_framework' ),
  1186.                                 'id'    => 'overlay_opacity',
  1187.                                 'type'  => 'select',
  1188.                                 'std'   => '0.5',
  1189.                                 'required'  => array( 'overlay_enable', 'not', '' ),
  1190.                                 'subtype'   => array(  
  1191.                                                     __( '0.1', 'avia_framework' )   => '0.1',
  1192.                                                     __( '0.2', 'avia_framework' )   => '0.2',
  1193.                                                     __( '0.3', 'avia_framework' )   => '0.3',
  1194.                                                     __( '0.4', 'avia_framework' )   => '0.4',
  1195.                                                     __( '0.5', 'avia_framework' )   => '0.5',
  1196.                                                     __( '0.6', 'avia_framework' )   => '0.6',
  1197.                                                     __( '0.7', 'avia_framework' )   => '0.7',
  1198.                                                     __( '0.8', 'avia_framework' )   => '0.8',
  1199.                                                     __( '0.9', 'avia_framework' )   => '0.9',
  1200.                                                     __( '1.0', 'avia_framework' )   => '1',
  1201.                                                 )
  1202.                             ),
  1203.  
  1204.                             array(
  1205.                                 'name'  => __( 'Overlay Color', 'avia_framework' ),
  1206.                                 'desc'  => __( 'Select a custom color for your overlay here. Leave empty if you want no color overlay', 'avia_framework' ),
  1207.                                 'id'    => 'overlay_color',
  1208.                                 'type'  => 'colorpicker',
  1209.                                 'required'  => array( 'overlay_enable', 'not', '' ),
  1210.                                 'std'   => '',
  1211.                             ),
  1212.  
  1213.                             array(
  1214.                                 'id'        => 'overlay_pattern',
  1215.                                 'name'      => __( 'Background Image', 'avia_framework'),
  1216.                                 'desc'      => __( 'Select an existing or upload a new background image', 'avia_framework'),
  1217.                                 'type'      => 'select',
  1218.                                 'required'  => array( 'overlay_enable', 'not', '' ),
  1219.                                 'subtype'   => array(
  1220.                                                     __( 'No Background Image', 'avia_framework')    => '',
  1221.                                                     __( 'Upload custom image', 'avia_framework')    => 'custom'
  1222.                                                 ),
  1223.                                 'std'       => '',
  1224.                                 'folder'    => 'images/background-images/',
  1225.                                 'folderlabel'   => '',
  1226.                                 'group'     => 'Select predefined pattern',
  1227.                                 'exclude'   => array( 'fullsize-', 'gradient' )
  1228.                             ),
  1229.  
  1230.                             array(
  1231.                                 'name'      => __( 'Custom Pattern', 'avia_framework' ),
  1232.                                 'desc'      => __( 'Upload your own seamless pattern', 'avia_framework' ),
  1233.                                 'id'        => 'overlay_custom_pattern',
  1234.                                 'type'      => 'image',
  1235.                                 'fetch'     => 'url',
  1236.                                 'secondary_img' => true,
  1237.                                 'required'  => array( 'overlay_pattern', 'equals', 'custom' ),
  1238.                                 'title'     => __( 'Insert Pattern', 'avia_framework' ),
  1239.                                 'button'    => __( 'Insert', 'avia_framework' ),
  1240.                                 'std'       => ''
  1241.                             )
  1242.                
  1243.                 );
  1244.  
  1245.             return $template;
  1246.         }
  1247.        
  1248.         /**
  1249.          * Slideshow Buttons Link Template
  1250.          *
  1251.          * @since 4.6.4
  1252.          * @param array $element
  1253.          * @return array
  1254.          */
  1255.         protected function slideshow_button_links( array $element )
  1256.         {
  1257.            
  1258.             $template = array(
  1259.                
  1260.                     array( 
  1261.                             'name'  => __( 'Apply a link or buttons to the slide?', 'avia_framework' ),
  1262.                             'desc'  => __( "You can choose to apply the link to the whole image or to add 'Call to Action Buttons' that get appended to the caption", 'avia_framework' ),
  1263.                             'id'    => 'link_apply',
  1264.                             'type'  => 'select',
  1265.                             'std'   => '',
  1266.                             'subtype'   => array(
  1267.                                                 __( 'No Link for this slide', 'avia_framework' ) => '',
  1268.                                                 __( 'Apply Link to Image', 'avia_framework' )   => 'image',
  1269.                                                 __( 'Attach one button', 'avia_framework' )     => 'button',
  1270.                                                 __( 'Attach two buttons', 'avia_framework' )    => 'button button-two'
  1271.                                             )
  1272.                     ),
  1273.  
  1274.                     array( 
  1275.                             'name'  => __( 'Image Link?', 'avia_framework' ),
  1276.                             'desc'  => __( 'Where should the Image link to?', 'avia_framework' ),
  1277.                             'id'    => 'link',
  1278.                             'required'  => array( 'link_apply', 'equals', 'image' ),
  1279.                             'type'  => 'linkpicker',
  1280.                             'fetchTMPL' => true,
  1281.                             'subtype'   => array(  
  1282.                                                 __( 'Open Image in Lightbox', 'avia_framework' )    => 'lightbox',
  1283.                                                 __( 'Set Manually', 'avia_framework' )              => 'manually',
  1284.                                                 __( 'Single Entry', 'avia_framework' )              => 'single',
  1285.                                                 __( 'Taxonomy Overview Page', 'avia_framework' )    => 'taxonomy',
  1286.                                             ),
  1287.                             'std'   => ''
  1288.                     ),
  1289.                            
  1290.                     array( 
  1291.                             'name'  => __( 'Open Link in new Window?', 'avia_framework' ),
  1292.                             'desc'  => __( 'Select here if you want to open the linked page in a new window', 'avia_framework' ),
  1293.                             'id'    => 'link_target',
  1294.                             'type'  => 'select',
  1295.                             'std'   => '',
  1296.                             'required'  => array( 'link', 'not_empty_and', 'lightbox' ),
  1297.                             'subtype'   => AviaHtmlHelper::linking_options()
  1298.                     ),  
  1299.    
  1300.                     array( 
  1301.                             'name'  => __( 'Button 1 Label', 'avia_framework' ),
  1302.                             'desc'  => __( 'This is the text that appears on your button.', 'avia_framework' ),
  1303.                             'id'    => 'button_label',
  1304.                             'type'  => 'input',
  1305.                             'container_class' => 'av_half av_half_first',
  1306.                             'required'  => array( 'link_apply', 'contains', 'button' ),
  1307.                             'std'   => 'Click me'
  1308.                     ), 
  1309.                                            
  1310.                     array( 
  1311.                             'type'          => 'template',
  1312.                             'template_id'   => 'named_colors',
  1313.                             'name'          => __( 'Button 1 Color', 'avia_framework' ),
  1314.                             'desc'          => __( 'Choose a color for your button here', 'avia_framework' ),
  1315.                             'id'            => 'button_color',
  1316.                             'std'           => 'light',
  1317.                             'container_class' => 'av_half',
  1318.                             'required'      => array( 'link_apply', 'contains', 'button' )
  1319.                     ),
  1320.                                
  1321.                     array( 
  1322.                             'name'  => __( 'Button 1 Link?', 'avia_framework' ),
  1323.                             'desc'  => __( 'Where should the Button link to?', 'avia_framework' ),
  1324.                             'id'    => 'link1',
  1325.                             'container_class' => 'av_half av_half_first',
  1326.                             'required'  => array( 'link_apply', 'contains', 'button' ),
  1327.                             'type'  => 'linkpicker',
  1328.                             'fetchTMPL' => true,
  1329.                             'subtype'   => array(  
  1330.                                                 __( 'Set Manually', 'avia_framework' )  => 'manually',
  1331.                                                 __( 'Single Entry', 'avia_framework' )  => 'single',
  1332.                                                 __( 'Taxonomy Overview Page', 'avia_framework' )    => 'taxonomy',
  1333.                                             ),
  1334.                             'std'   => ''
  1335.                     ),
  1336.  
  1337.                     array( 
  1338.                             'name'  => __( 'Button 1 Link Target?', 'avia_framework' ),
  1339.                             'desc'  => __( 'Select here if you want to open the linked page in a new window', 'avia_framework' ),
  1340.                             'id'    => 'link_target1',
  1341.                             'type'  => 'select',
  1342.                             'std'   => '',
  1343.                             'container_class' => 'av_half',
  1344.                             'required'  => array( 'link_apply', 'contains', 'button' ),
  1345.                             'subtype'   => AviaHtmlHelper::linking_options()
  1346.                     ),                         
  1347.                                
  1348.                     array( 
  1349.                             'name'  => __( 'Button 2 Label', 'avia_framework' ),
  1350.                             'desc'  => __( 'This is the text that appears on your second button.', 'avia_framework' ),
  1351.                             'id'    => 'button_label2',
  1352.                             'type'  => 'input',
  1353.                             'container_class' => 'av_half av_half_first',
  1354.                             'required'  => array( 'link_apply', 'contains',' button-two' ),
  1355.                             'std'   => 'Click me'
  1356.                     ), 
  1357.                                            
  1358.                     array( 
  1359.                             'type'          => 'template',
  1360.                             'template_id'   => 'named_colors',
  1361.                             'name'          => __( 'Button 2 Color', 'avia_framework' ),
  1362.                             'desc'          => __( 'Choose a color for your second button here', 'avia_framework' ),
  1363.                             'id'            => 'button_color2',
  1364.                             'std'           => 'light',
  1365.                             'container_class' => 'av_half',
  1366.                             'required'      => array( 'link_apply', 'contains', 'button-two' )
  1367.                     ),
  1368.                        
  1369.                     array( 
  1370.                             'name'  => __('Button 2 Link?', 'avia_framework' ),
  1371.                             'desc'  => __('Where should the Button link to?', 'avia_framework' ),
  1372.                             'id'    => 'link2',
  1373.                             'container_class' => 'av_half av_half_first',
  1374.                             'required'  => array( 'link_apply', 'contains','button-two' ),
  1375.                             'type'  => 'linkpicker',
  1376.                             'fetchTMPL' => true,
  1377.                             'subtype'   => array(  
  1378.                                                 __( 'Set Manually', 'avia_framework' ) => 'manually',
  1379.                                                 __( 'Single Entry', 'avia_framework' ) => 'single',
  1380.                                                 __( 'Taxonomy Overview Page',  'avia_framework' ) => 'taxonomy',
  1381.                                             ),
  1382.                             'std'   => ''
  1383.                     ),
  1384.  
  1385.                     array( 
  1386.                             'name'  => __( 'Button 2 Link Target?', 'avia_framework' ),
  1387.                             'desc'  => __( 'Select here if you want to open the linked page in a new window', 'avia_framework' ),
  1388.                             'id'    => 'link_target2',
  1389.                             'type'  => 'select',
  1390.                             'std'   => '',
  1391.                             'container_class' => 'av_half',
  1392.                             'required'=> array( 'link_apply', 'contains', 'button-two' ),
  1393.                             'subtype' => AviaHtmlHelper::linking_options()
  1394.                     )
  1395.                                    
  1396.                
  1397.                 );
  1398.  
  1399.             return $template;
  1400.         }
  1401.        
  1402.         /**
  1403.          * Button Color Template
  1404.          *
  1405.          * @since 4.7.5.1
  1406.          * @param array $element
  1407.          * @return array
  1408.          */
  1409.         protected function button_colors( array $element )
  1410.         {
  1411.             $color_id = isset( $element['color_id'] ) ? $element['color_id'] : 'color';
  1412.             $custom_id = isset( $element['custom_id'] ) && is_string( $element['custom_id'] ) ? $element['custom_id'] : 'custom';
  1413.             $required = isset( $element['required'] ) ? $element['required'] : array();
  1414.            
  1415.             if( isset( $element['ids'] ) && is_array( $element['ids'] ) )
  1416.             {
  1417.                 $ids = $element['ids'];
  1418.             }
  1419.             else
  1420.             {
  1421.                 $ids = array(
  1422.                         'bg'        => array(
  1423.                                         'color'     => $color_id . '_bg',
  1424.                                         'custom'    => 'custom',
  1425.                                         'custom_id' => $custom_id . '_bg',
  1426.                                     ),
  1427.                         'bg_hover'  => array(
  1428.                                         'color'     => $color_id . '_bg_hover',
  1429.                                         'custom'    => 'custom',
  1430.                                         'custom_id' => $custom_id . '_bg_hover',
  1431.                                     ),
  1432.                         'font'      => array(
  1433.                                         'color'     => $color_id . '_font',
  1434.                                         'custom'    => 'custom',
  1435.                                         'custom_id' => $custom_id . '_font',
  1436.                                     ),
  1437.                         'font_hover' => array(
  1438.                                         'color'     => $color_id . '_font_hover',
  1439.                                         'custom'    => 'custom',
  1440.                                         'custom_id' => $custom_id . '_font_hover',
  1441.                                     ),
  1442.                         );
  1443.             }
  1444.            
  1445.             if( isset( $element['name'] ) && is_array( $element['name'] ) )
  1446.             {
  1447.                 $name = $element['name'];
  1448.             }
  1449.             else
  1450.             {
  1451.                 $name = array(
  1452.                             'bg'            =>  __( 'Button Background Color', 'avia_framework' ),
  1453.                             'bg_hover'      =>  __( 'Button Background Color On Hover', 'avia_framework' ),
  1454.                             'font'          =>  __( 'Button Font Color', 'avia_framework' ),
  1455.                             'font_hover'    =>  __( 'Button Font Color On Hover', 'avia_framework' )
  1456.                         );
  1457.             }
  1458.            
  1459.             if( isset( $element['desc'] ) && is_array( $element['desc'] ) )
  1460.             {
  1461.                 $desc = $element['desc'];
  1462.             }
  1463.             else
  1464.             {
  1465.                 $desc = array(
  1466.                             'bg'            =>  __( 'Select background color for your button here', 'avia_framework' ),
  1467.                             'bg_hover'      =>  __( 'Select background color on hover for your button here', 'avia_framework' ),
  1468.                             'font'          =>  __( 'Select font color for your button here', 'avia_framework' ),
  1469.                             'font_hover'    =>  __( 'Select font color on hover for your button here', 'avia_framework' )
  1470.                         );
  1471.             }
  1472.            
  1473.             if( isset( $element['std'] ) && is_array( $element['std'] ) )
  1474.             {
  1475.                 $std = $element['std'];
  1476.             }
  1477.             else
  1478.             {
  1479.                 $std = array(
  1480.                             'bg'                =>  'theme-color',
  1481.                             'bg_hover'          =>  'theme-color-highlight',
  1482.                             'font'              =>  '#ffffff',
  1483.                             'font_hover'        =>  '#ffffff',
  1484.                             'custom_bg'         =>  '#444444',
  1485.                             'custom_bg_hover'   =>  '#444444',
  1486.                             'custom_font'       =>  '#ffffff',
  1487.                             'custom_font_hover' =>  '#ffffff'
  1488.                         );
  1489.             }
  1490.            
  1491.             if( isset( $element['translucent'] ) && is_array( $element['translucent'] ) )
  1492.             {
  1493.                 $translucent = $element['translucent'];
  1494.             }
  1495.             else
  1496.             {
  1497.                 $translucent = array(
  1498.                                     'bg'            =>  '',
  1499.                                     'bg_hover'      =>  '',
  1500.                                     'font'          =>  array(),
  1501.                                     'font_hover'    =>  array()
  1502.                                 );
  1503.             }
  1504.            
  1505.             $template = array(
  1506.                
  1507.                     array( 
  1508.                         'type'          => 'template',
  1509.                         'template_id'   => 'named_colors',
  1510.                         'id'            => $ids['bg']['color'],
  1511.                         'name'          => $name['bg'],
  1512.                         'desc'          => $desc['bg'],
  1513.                         'std'           => $std['bg'],
  1514.                         'translucent'   => $translucent['bg'],
  1515.                         'custom'        => $ids['bg']['custom'],
  1516.                         'required'      => $required
  1517.                     ),
  1518.  
  1519.                     array( 
  1520.                         'name'  => $name['bg'],
  1521.                         'desc'  => $desc['bg'],
  1522.                         'id'    => $ids['bg']['custom_id'],
  1523.                         'type'  => 'colorpicker',
  1524.                         'std'   => $std['custom_bg'],
  1525.                         'required'  => array( $ids['bg']['color'], 'equals', $ids['bg']['custom'] )
  1526.                     ),
  1527.                
  1528.                     array( 
  1529.                         'type'          => 'template',
  1530.                         'template_id'   => 'named_colors',
  1531.                         'id'            => $ids['bg_hover']['color'],
  1532.                         'name'          => $name['bg_hover'],
  1533.                         'desc'          => $desc['bg_hover'],
  1534.                         'std'           => $std['bg_hover'],
  1535.                         'translucent'   => $translucent['bg_hover'],
  1536.                         'custom'        => $ids['bg_hover']['custom'],
  1537.                         'required'      => $required
  1538.                     ),
  1539.  
  1540.                     array( 
  1541.                         'name'  => $name['bg_hover'],
  1542.                         'desc'  => $desc['bg_hover'],
  1543.                         'id'    => $ids['bg_hover']['custom_id'],
  1544.                         'type'  => 'colorpicker',
  1545.                         'std'   => $std['custom_bg_hover'],
  1546.                         'required'  => array( $ids['bg_hover']['color'], 'equals', $ids['bg_hover']['custom'] )
  1547.                     ),
  1548.                
  1549.                     array( 
  1550.                         'type'          => 'template',
  1551.                         'template_id'   => 'named_colors',
  1552.                         'id'            => $ids['font']['color'],
  1553.                         'name'          => $name['font'],
  1554.                         'desc'          => $desc['font'],
  1555.                         'std'           => $std['font'],
  1556.                         'translucent'   => $translucent['font'],
  1557.                         'custom'        => $ids['font']['custom'],
  1558.                         'required'      => $required
  1559.                     ),
  1560.                
  1561.                     array( 
  1562.                         'name'  => $name['font'],
  1563.                         'desc'  => $desc['font'],
  1564.                         'id'    => $ids['font']['custom_id'],
  1565.                         'type'  => 'colorpicker',
  1566.                         'std'   => $std['font'],
  1567.                         'required'  => array( $ids['font']['color'], 'equals', $ids['font']['custom'] )
  1568.                     ),
  1569.                
  1570. //                  array( 
  1571. //                      'type'          => 'template',
  1572. //                      'template_id'   => 'named_colors',
  1573. //                      'id'            => $ids['font_hover']['color'],
  1574. //                      'name'          => $name['font_hover'],
  1575. //                      'desc'          => $desc['font_hover'],
  1576. //                      'std'           => $std['font_hover'],
  1577. //                      'translucent'   => $translucent['font_hover'],
  1578. //                      'custom'        => $ids['font_hover']['custom'],
  1579. //                      'required'      => $required
  1580. //                  ),
  1581. //             
  1582. //                  array( 
  1583. //                      'name'  => $name['font_hover'],
  1584. //                      'desc'  => $desc['font_hover'],
  1585. //                      'id'    => $ids['font_hover']['custom_id'],
  1586. //                      'type'  => 'colorpicker',
  1587. //                      'std'   => $std['font_hover'],
  1588. //                      'required'  => array( $ids['font_hover']['color'], 'equals', $ids['font_hover']['custom'] )
  1589. //                  )
  1590.                
  1591.                 );
  1592.            
  1593.             return $template;
  1594.         }
  1595.        
  1596.         /**
  1597.          * Named Color Template
  1598.          *
  1599.          * @since 4.5.6.1
  1600.          * @param array $element
  1601.          * @return array
  1602.          */
  1603.         protected function named_colors( array $element )
  1604.         {
  1605.             $name = isset( $element['name'] ) ? $element['name'] : __( 'Button Color', 'avia_framework' );
  1606.             $desc = isset( $element['desc'] ) ? $element['desc'] : __( 'Choose a color for your button here', 'avia_framework' );
  1607.             $id = isset( $element['id'] ) ? $element['id'] : 'color';
  1608.             $std = isset( $element['std'] ) ? $element['std'] : 'theme-color';
  1609.             $required = isset( $element['required'] ) ? $element['required'] : array();
  1610.             $container_class  = isset( $element['container_class'] ) ? $element['container_class'] : '';
  1611.             $theme_col_key = isset( $element['theme-col-key'] ) ? $element['theme-col-key'] : 'theme-color';
  1612.            
  1613.             if( isset( $element['translucent'] ) && is_array( $element['translucent'] ) )
  1614.             {
  1615.                 $translucent = $element['translucent'];
  1616.             }
  1617.             else
  1618.             {
  1619.                 $translucent = array(
  1620.                                     __( 'Light Transparent', 'avia_framework' ) => 'light',
  1621.                                     __( 'Dark Transparent', 'avia_framework' )  => 'dark',
  1622.                                 );
  1623.             }
  1624.            
  1625.             $colored = array(
  1626.                             __( 'Theme Color', 'avia_framework' )           => $theme_col_key,
  1627.                             __( 'Theme Color Highlight', 'avia_framework' ) => 'theme-color-highlight',
  1628.                             __( 'Theme Color Subtle', 'avia_framework' )    => 'theme-color-subtle',
  1629.                             __( 'Blue', 'avia_framework' )      => 'blue',
  1630.                             __( 'Red',  'avia_framework' )      => 'red',
  1631.                             __( 'Green', 'avia_framework' )     => 'green',
  1632.                             __( 'Orange', 'avia_framework' )    => 'orange',
  1633.                             __( 'Aqua', 'avia_framework' )      => 'aqua',
  1634.                             __( 'Teal', 'avia_framework' )      => 'teal',
  1635.                             __( 'Purple', 'avia_framework' )    => 'purple',
  1636.                             __( 'Pink', 'avia_framework' )      => 'pink',
  1637.                             __( 'Silver', 'avia_framework' )    => 'silver',
  1638.                             __( 'Grey', 'avia_framework' )      => 'grey',
  1639.                             __( 'Black', 'avia_framework' )     => 'black',
  1640.                         );
  1641.            
  1642.             if( ! empty( $element['no_alternate'] ) )
  1643.             {
  1644.                 array_splice( $colored, 1, 2 );
  1645.             }
  1646.            
  1647.             if( ! empty( $element['custom'] ) )
  1648.             {
  1649.                 $val = true === $element['custom'] ? 'custom' : $element['custom'];
  1650.                 $colored[ __( 'Custom Color', 'avia_framework' ) ] = $val;
  1651.             }
  1652.            
  1653.             $e = array(
  1654.                         'name'  => $name,
  1655.                         'desc'  => $desc,
  1656.                         'id'    => $id,
  1657.                         'type'  => 'select',
  1658.                         'std'   => $std,
  1659.                         'container_class' => $container_class,
  1660.                         'required'  => $required,
  1661.                         'subtype'   => array()     
  1662.                 );
  1663.            
  1664.             if( ! empty( $translucent ) )
  1665.             {
  1666.                 $e['subtype'][ __( 'Translucent Buttons', 'avia_framework' ) ] = $translucent;
  1667.                 $e['subtype'][ __( 'Colored Buttons', 'avia_framework' ) ] = $colored;
  1668.             }
  1669.             else
  1670.             {
  1671.                 $e['subtype'] = $colored;
  1672.             }
  1673.            
  1674.             $template = array( $e );
  1675.            
  1676.             return $template;
  1677.         }
  1678.        
  1679.        
  1680.         /**
  1681.          * Masonry Captions Template
  1682.          *
  1683.          * @since 4.5.6.1
  1684.          * @param array $element
  1685.          * @return array
  1686.          */
  1687.         protected function masonry_captions( array $element )
  1688.         {
  1689.             $template = array(
  1690.                
  1691.                     array(
  1692.                         'name'  => __('Element Title and Excerpt', 'avia_framework' ),
  1693.                         'desc'  => __('You can choose if you want to display title and/or excerpt', 'avia_framework' ),
  1694.                         'id'    => 'caption_elements',
  1695.                         'type'  => 'select',
  1696.                         'std'   => 'title excerpt',
  1697.                         'subtype'   => array(
  1698.                                             __( 'Display Title and Excerpt', 'avia_framework' ) => 'title excerpt',
  1699.                                             __( 'Display Title', 'avia_framework' )             => 'title',
  1700.                                             __( 'Display Excerpt', 'avia_framework' )           => 'excerpt',
  1701.                                             __( 'Display Neither', 'avia_framework' )           => 'none',
  1702.                                         )
  1703.                     ), 
  1704.  
  1705.                     array(
  1706.                         'name'  => __( 'Element Title and Excerpt Styling', 'avia_framework' ),
  1707.                         'desc'  => __( 'You can choose the styling for the title and excerpt here', 'avia_framework' ),
  1708.                         'id'    => 'caption_styling',
  1709.                         'type'  => 'select',
  1710.                         'std'   => 'always',
  1711.                         'required' => array( 'caption_elements', 'not', 'none' ),
  1712.                         'subtype' => array(
  1713.                                             __( 'Default display (at the bottom of the elements image)', 'avia_framework' ) => '',
  1714.                                             __( 'Display as centered overlay (overlays the image)', 'avia_framework' )      => 'overlay',
  1715.                                         )
  1716.                     ), 
  1717.  
  1718.  
  1719.  
  1720.                     array(
  1721.                         'name'  => __( 'Element Title and Excerpt display settings', 'avia_framework' ),
  1722.                         'desc'  => __( 'You can choose whether to always display Title and Excerpt or only on hover', 'avia_framework' ),
  1723.                         'id'    => 'caption_display',
  1724.                         'type'  => 'select',
  1725.                         'std'   => 'always',
  1726.                         'required'  => array( 'caption_elements', 'not', 'none' ),
  1727.                         'subtype'   => array(
  1728.                                             __( 'Always Display', 'avia_framework' )            => 'always',
  1729.                                             __( 'Display on mouse hover', 'avia_framework' )    => 'on-hover',
  1730.                                             __( 'Hide on mouse hover', 'avia_framework' )       => 'on-hover-hide',
  1731.                                         )
  1732.                     )  
  1733.                 );
  1734.            
  1735.             return $template;
  1736.         }
  1737.        
  1738.        
  1739.         /**
  1740.          * Background Image Position Template
  1741.          *
  1742.          * @since 4.5.6.1
  1743.          * @param array $element
  1744.          * @return array
  1745.          */
  1746.         protected function background_image_position( array $element )
  1747.         {
  1748.             $id_pos = isset( $element['args']['id_pos'] ) ? trim(  $element['args']['id_pos'] ) : 'background_position';
  1749.             $id_repeat = isset( $element['args']['id_repeat'] ) ? trim(  $element['args']['id_repeat'] ) : 'background_repeat';
  1750.            
  1751.             $template = array();
  1752.                
  1753.             $template[] = array(
  1754.                             'name'  => __( 'Background Image Position', 'avia_framework' ),
  1755.                             'id'    => $id_pos,
  1756.                             'type'  => 'select',
  1757.                             'std'   => 'top left',
  1758.                             'required' => array( 'src', 'not','' ),
  1759.                             'subtype' => array(  
  1760.                                             __( 'Top Left', 'avia_framework' )       => 'top left',
  1761.                                             __( 'Top Center', 'avia_framework' )     => 'top center',
  1762.                                             __( 'Top Right', 'avia_framework' )      => 'top right',
  1763.                                             __( 'Bottom Left', 'avia_framework' )    => 'bottom left',
  1764.                                             __( 'Bottom Center', 'avia_framework' )  => 'bottom center',
  1765.                                             __( 'Bottom Right', 'avia_framework' )   => 'bottom right',
  1766.                                             __( 'Center Left', 'avia_framework' )    => 'center left',
  1767.                                             __( 'Center Center', 'avia_framework' )  => 'center center',
  1768.                                             __( 'Center Right', 'avia_framework' )   => 'center right'
  1769.                                         )
  1770.                     );
  1771.            
  1772.             $sub = array(  
  1773.                         __( 'No Repeat', 'avia_framework' )          => 'no-repeat',
  1774.                         __( 'Repeat', 'avia_framework' )             => 'repeat',
  1775.                         __( 'Tile Horizontally', 'avia_framework' )  => 'repeat-x',
  1776.                         __( 'Tile Vertically', 'avia_framework' )    => 'repeat-y',
  1777.                         __( 'Stretch to fit (stretches image to cover the element)', 'avia_framework' )             => 'stretch',
  1778.                         __( 'Scale to fit (scales image so the whole image is always visible)', 'avia_framework' )  => 'contain'
  1779.                     );
  1780.            
  1781.             if( ! empty( $element['args']['repeat_remove'] ) )
  1782.             {
  1783.                 foreach( $sub as $key => $value )
  1784.                 {
  1785.                     if( in_array( $value, $element['args']['repeat_remove'] ) )
  1786.                     {
  1787.                         unset( $sub[ $key ] );
  1788.                     }
  1789.                 }
  1790.             }
  1791.  
  1792.             $template[] = array(
  1793.                             'name'  => __( 'Background Repeat', 'avia_framework' ),
  1794.                             'id'    => $id_repeat,
  1795.                             'type'  => 'select',
  1796.                             'std'   => 'no-repeat',
  1797.                             'required' => array( 'src', 'not','' ),
  1798.                             'subtype' => $sub
  1799.                 );
  1800.  
  1801.             return $template;
  1802.         }
  1803.        
  1804.        
  1805.         /**
  1806.          * Date Query Template
  1807.          *
  1808.          * @since 4.5.6.1
  1809.          * @param array $element
  1810.          * @return array
  1811.          */
  1812.         protected function date_query( array $element )
  1813.         {
  1814.             $template = array(
  1815.                
  1816.                     array( 
  1817.                             'name'      => __( 'Do you want to filter entries by date?', 'avia_framework' ),
  1818.                             'desc'      => __( 'Do you want to display entries within date boundaries only? Can be used e.g. to create archives.', 'avia_framework' ),
  1819.                             'id'        => 'date_filter',
  1820.                             'type'      => 'select',
  1821.                             'std'       => '',
  1822.                             'subtype'   => array(
  1823.                                                 __( 'Display all entries', 'avia_framework' )       => '',
  1824.                                                 __( 'Filter entries by date', 'avia_framework' )    => 'date_filter'
  1825.                                             )
  1826.                         ),
  1827.                    
  1828.                     array( 
  1829.                             'name'      => __( 'Start Date', 'avia_framework' ),
  1830.                             'desc'      => __( 'Pick a start date.', 'avia_framework' ),
  1831.                             'id'        => 'date_filter_start',
  1832.                             'type'      => 'datepicker',
  1833.                             'required'  => array( 'date_filter', 'equals', 'date_filter' ),
  1834.                             'container_class'   => 'av_third av_third_first',
  1835.                             'std'       => '',
  1836.                             'dp_params' => array(
  1837.                                                 'dateFormat'        => 'yy/mm/dd',
  1838.                                                 'changeMonth'       => true,
  1839.                                                 'changeYear'        => true,
  1840.                                                 'container_class'   => 'select_dates_30'
  1841.                                             )
  1842.                         ),
  1843.                    
  1844.                     array( 
  1845.                             'name'      => __( 'End Date', 'avia_framework' ),
  1846.                             'desc'      => __( 'Pick the end date. Leave empty to display all entries after the start date.', 'avia_framework' ),
  1847.                             'id'        => 'date_filter_end',
  1848.                             'type'      => 'datepicker',
  1849.                             'required'  => array( 'date_filter', 'equals', 'date_filter' ),
  1850.                             'container_class'   => 'av_2_third',
  1851.                             'std'       => '',
  1852.                             'dp_params' => array(
  1853.                                                 'dateFormat'        => 'yy/mm/dd',
  1854.                                                 'changeMonth'       => true,
  1855.                                                 'changeYear'        => true,
  1856.                                                 'container_class'   => 'select_dates_30'
  1857.                                             )
  1858.                         ),
  1859.                    
  1860.                     array( 
  1861.                             'name'          => __( 'Date Formt','avia_framework' ),
  1862.                             'desc'          => __( 'Define the same date format as used in date picker', 'avia_framework' ),
  1863.                             'id'            => 'date_filter_format',
  1864.                             'container_class'   => 'avia-hidden',
  1865.                             'type'          => 'input',
  1866.                             'std'           => 'yy/mm/dd'
  1867.                         )
  1868.                                    
  1869.                 );
  1870.            
  1871.                 if( ! empty ( $element['template_required'][0] ) )
  1872.                 {
  1873.                     $template[0]['required'] = $element['template_required'][0];
  1874.                 }
  1875.                
  1876.             return $template;
  1877.         }
  1878.        
  1879.         /**
  1880.          * Complete Screen Options Tab with several content options
  1881.          *
  1882.          * @since 4.5.7.1
  1883.          * @param array $element
  1884.          * @param boolean $all              for backwards comp prior 4.6.4
  1885.          * @return array
  1886.          */
  1887.         protected function screen_options_tab( array $element, $all = true )
  1888.         {
  1889.             $template = array();
  1890.            
  1891.             /**
  1892.              * This is the default template when missing
  1893.              */
  1894.             $sub_templates =  array( 'screen_options_visibility' );
  1895.            
  1896.             if( isset( $element['templates_include'] ) && ! empty( $element['templates_include']  ) )
  1897.             {
  1898.                 $sub_templates = (array) $element['templates_include'];
  1899.             }
  1900.            
  1901.             if(  true === $all )
  1902.             {
  1903.                 $template[] = array(
  1904.                                 'type'          => 'tab',       //  new --->  toggle
  1905.                                 'name'          => __( 'Responsive', 'avia_framework' ),
  1906.                                 'nodescription' => true
  1907.                             );
  1908.             }
  1909.            
  1910.             foreach( $sub_templates as $sub_template )
  1911.             {
  1912.                 if( false !== $this->template_exists( $sub_template ) )
  1913.                 {
  1914.                     $temp = array( 
  1915.                                     'type'          => 'template',
  1916.                                     'template_id'   => $sub_template,
  1917.                                 );     
  1918.                    
  1919.                     if( isset( $element['subtype'][ $sub_template ] ) && is_array( $element['subtype'][ $sub_template ] ) )
  1920.                     {
  1921.                         $temp['subtype'] = $element['subtype'][ $sub_template ];
  1922.                     }
  1923.                    
  1924.                     $template[] = $temp;
  1925.                 }
  1926.             }
  1927.                                
  1928.             if(  true === $all )
  1929.             {
  1930.                 $template[] = array(
  1931.                                 'type'          => 'tab_close',
  1932.                                 'nodescription' => true
  1933.                             );
  1934.             }                  
  1935.                        
  1936.             return $template;
  1937.         }
  1938.        
  1939.        
  1940.         /**
  1941.          * Simple checkboxes for element visibility
  1942.          *
  1943.          * @since 4.5.6.1
  1944.          * @param array $element
  1945.          * @return array
  1946.          */
  1947.         protected function screen_options_visibility( array $element )
  1948.         {
  1949.             $template = array(
  1950.                            
  1951.                             array(
  1952.                                     'type'              => 'heading',
  1953.                                     'name'              => __( 'Element Visibility', 'avia_framework' ),
  1954.                                     'desc'              => __( 'Set the visibility for this element, based on the device screensize.', 'avia_framework' ),
  1955.                             ),
  1956.                            
  1957.                             array( 
  1958.                                     'desc'              => __( 'Hide on large screens (wider than 990px - eg: Desktop)', 'avia_framework' ),
  1959.                                     'id'                => 'av-desktop-hide',
  1960.                                     'std'               => '',
  1961.                                     'container_class'   => 'av-multi-checkbox',
  1962.                                     'type'              => 'checkbox'
  1963.                                 ),
  1964.                                
  1965.                             array( 
  1966.  
  1967.                                     'desc'              => __( 'Hide on medium sized screens (between 768px and 989px - eg: Tablet Landscape)', 'avia_framework' ),
  1968.                                     'id'                => 'av-medium-hide',
  1969.                                     'std'               => '',
  1970.                                     'container_class'   => 'av-multi-checkbox',
  1971.                                     'type'              => 'checkbox'
  1972.                                 ),
  1973.                                        
  1974.                             array( 
  1975.  
  1976.                                     'desc'              => __( 'Hide on small screens (between 480px and 767px - eg: Tablet Portrait)', 'avia_framework' ),
  1977.                                     'id'                => 'av-small-hide',
  1978.                                     'std'               => '',
  1979.                                     'container_class'   => 'av-multi-checkbox',
  1980.                                     'type'              => 'checkbox'
  1981.                                 ),
  1982.                                        
  1983.                             array( 
  1984.                                    
  1985.                                     'desc'              => __( 'Hide on very small screens (smaller than 479px - eg: Smartphone Portrait)', 'avia_framework' ),
  1986.                                     'id'                => 'av-mini-hide',
  1987.                                     'std'               => '',
  1988.                                     'container_class'   => 'av-multi-checkbox',
  1989.                                     'type'              => 'checkbox'
  1990.                                 ),
  1991.                            
  1992.                
  1993.                         );
  1994.            
  1995.             return $template;
  1996.         }
  1997.        
  1998.         /**
  1999.          * Select boxes for Title Font Sizes
  2000.          *
  2001.          * @since 4.5.7.1
  2002.          * @param array $element
  2003.          * @return array
  2004.          */
  2005.         protected function font_sizes_title( array $element )
  2006.         {
  2007.             $subtype = AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' );
  2008.            
  2009.             if( isset( $element['subtype'] ) && is_array( $element['subtype'] ) )
  2010.             {
  2011.                 $subtype = $element['subtype'];
  2012.             }
  2013.            
  2014.             $template = array(
  2015.                
  2016.                             array( 
  2017.                                     'name'      => __( 'Font Size for medium sized screens (between 768px and 989px - eg: Tablet Landscape)', 'avia_framework' ),
  2018.                                     'id'        => 'av-medium-font-size-title',
  2019.                                     'type'      => 'select',
  2020.                                     'subtype'   => $subtype,
  2021.                                     'std'       => ''
  2022.                                 ),
  2023.                                    
  2024.                             array( 
  2025.                                     'name'      => __( 'Font Size for small screens (between 480px and 767px - eg: Tablet Portrait)', 'avia_framework' ),
  2026.                                     'id'        => 'av-small-font-size-title',
  2027.                                     'type'      => 'select',
  2028.                                     'subtype'   => $subtype,
  2029.                                     'std'       => ''
  2030.                                 ),
  2031.                                    
  2032.                             array( 
  2033.                                     'name'      => __( 'Font Size for very small screens (smaller than 479px - eg: Smartphone Portrait)', 'avia_framework' ),
  2034.                                     'id'        => 'av-mini-font-size-title',
  2035.                                     'type'      => 'select',
  2036.                                     'subtype'   => $subtype,
  2037.                                     'std'       => ''
  2038.                                 )
  2039.                
  2040.                         );
  2041.            
  2042.             return $template;
  2043.         }
  2044.        
  2045.         /**
  2046.          * Select boxes for Content Font Sizes
  2047.          *
  2048.          * @since 4.5.7.1
  2049.          * @param array $element
  2050.          * @return array
  2051.          */
  2052.         protected function font_sizes_content( array $element )
  2053.         {
  2054.             $subtype = AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' );
  2055.            
  2056.             if( isset( $element['subtype'] ) && is_array( $element['subtype'] ) )
  2057.             {
  2058.                 $subtype = $element['subtype'];
  2059.             }
  2060.            
  2061.             $template = array(
  2062.                             array( 
  2063.                                     'name'      => __( 'Font Size for medium sized screens (between 768px and 989px - eg: Tablet Landscape)', 'avia_framework' ),
  2064.                                     'id'        => 'av-medium-font-size',
  2065.                                     'type'      => 'select',
  2066.                                     'subtype'   => $subtype,
  2067.                                     'std'       => ''
  2068.                                 ),
  2069.                                    
  2070.                             array( 
  2071.                                     'name'      => __( 'Font Size for small screens (between 480px and 767px - eg: Tablet Portrait)', 'avia_framework' ),
  2072.                                     'id'        => 'av-small-font-size',
  2073.                                     'type'      => 'select',
  2074.                                     'subtype'   => $subtype,
  2075.                                     'std'       => ''
  2076.                                 ),
  2077.                                    
  2078.                             array( 
  2079.                                     'name'      => __( 'Font Size for very small screens (smaller than 479px - eg: Smartphone Portrait)', 'avia_framework' ),
  2080.                                     'id'        => 'av-mini-font-size',
  2081.                                     'type'      => 'select',
  2082.                                     'subtype'   => $subtype,
  2083.                                     'std'       => ''
  2084.                                 )              
  2085.                         );
  2086.            
  2087.             return $template;
  2088.         }
  2089.  
  2090.         /**
  2091.          * Select boxes for Heading Font Size
  2092.          *
  2093.          * @since 4.5.7.1
  2094.          * @param array $element
  2095.          * @return array
  2096.          */
  2097.         protected function heading_font_size( array $element )
  2098.         {
  2099.             $title = array(
  2100.                             array(
  2101.                                     'name'      => __( 'Heading Font Size', 'avia_framework' ),
  2102.                                     'desc'      => __( 'Set the font size for the heading, based on the device screensize.', 'avia_framework' ),
  2103.                                     'type'      => 'heading',
  2104.                                     'description_class' => 'av-builder-note av-neutral',
  2105.                                 )
  2106.                             );
  2107.            
  2108.             $fonts = $this->font_sizes_title( $element );
  2109.             $template = array_merge( $title, $fonts );
  2110.            
  2111.             return $template;
  2112.         }
  2113.        
  2114.         /**
  2115.          * Select boxes for Content Font Size
  2116.          *
  2117.          * @since 4.5.7.1
  2118.          * @param array $element
  2119.          * @return array
  2120.          */
  2121.         protected function content_font_size( array $element )
  2122.         {
  2123.             $title = array(
  2124.                             array(
  2125.                                     'name'      => __( 'Content Font Size', 'avia_framework' ),
  2126.                                     'desc'      => __( 'Set the font size for the content, based on the device screensize.', 'avia_framework' ),
  2127.                                     'type'      => 'heading',
  2128.                                     'description_class' => 'av-builder-note av-neutral',
  2129.                                 )
  2130.                         );
  2131.            
  2132.             $fonts = $this->font_sizes_content( $element );
  2133.             $template = array_merge( $title, $fonts );
  2134.            
  2135.             return $template;
  2136.         }
  2137.        
  2138.         /**
  2139.          * Select boxes for Subheading Font Size
  2140.          *
  2141.          * @since 4.5.7.1
  2142.          * @param array $element
  2143.          * @return array
  2144.          */
  2145.         protected function subheading_font_size( array $element )
  2146.         {
  2147.             $template = $this->content_font_size( $element );
  2148.            
  2149.             $title = array(
  2150.                             array(
  2151.                                 'name'      => __( 'Subheading Font Size', 'avia_framework' ),
  2152.                                 'desc'      => __( 'Set the font size for the subheading, based on the device screensize.', 'avia_framework' ),
  2153.                                 'type'      => 'heading',
  2154.                                 'description_class' => 'av-builder-note av-neutral',
  2155.                             )
  2156.                         );
  2157.            
  2158.            
  2159.             $fonts = $this->font_sizes_content( $element );
  2160.             $template = array_merge( $title, $fonts );
  2161.            
  2162.             return $template;
  2163.         }
  2164.        
  2165.         /**
  2166.          * Select boxes for Number Font Size (countdown)
  2167.          *
  2168.          * @since 4.5.7.1
  2169.          * @param array $element
  2170.          * @return array
  2171.          */
  2172.         protected function number_font_size( array $element )
  2173.         {
  2174.             $title = array(
  2175.                             array(
  2176.                                     'name'      => __( 'Number Font Size', 'avia_framework' ),
  2177.                                     'desc'      => __( 'Set the font size for the number, based on the device screensize.', 'avia_framework' ),
  2178.                                     'type'      => 'heading',
  2179.                                     'description_class' => 'av-builder-note av-neutral',
  2180.                             )
  2181.                         );
  2182.            
  2183.             $fonts = $this->font_sizes_title( $element );
  2184.             $template = array_merge( $title, $fonts );
  2185.            
  2186.             return $template;
  2187.         }
  2188.        
  2189.         /**
  2190.          * Select boxes for Text Font Size (countdown)
  2191.          *
  2192.          * @since 4.5.7.1
  2193.          * @param array $element
  2194.          * @return array
  2195.          */
  2196.         protected function text_font_size( array $element )
  2197.         {
  2198.             $title = array(
  2199.                             array(
  2200.                                     'name'      => __( 'Text Font Size', 'avia_framework' ),
  2201.                                     'desc'      => __( 'Set the font size for the text, based on the device screensize.', 'avia_framework' ),
  2202.                                     'type'      => 'heading',
  2203.                                     'description_class' => 'av-builder-note av-neutral',
  2204.                             )
  2205.                         );
  2206.            
  2207.             $fonts = $this->font_sizes_content( $element );
  2208.             $template = array_merge( $title, $fonts );
  2209.            
  2210.             return $template;
  2211.         }
  2212.        
  2213.         /**
  2214.          * Select boxes for Columns ( 1 - 4 )
  2215.          *
  2216.          * @since 4.5.7.1
  2217.          * @param array $element
  2218.          * @return array
  2219.          */
  2220.         protected function column_count( array $element )
  2221.         {
  2222.             $subtype = AviaHtmlHelper::number_array( 1, 4, 1, array( __( 'Default', 'avia_framework' ) => '' ) );
  2223.            
  2224.             $template = array(
  2225.                
  2226.                             array( 
  2227.                                     'name'      => __( 'Column count for medium sized screens (between 768px and 989px - eg: Tablet Landscape)', 'avia_framework' ),
  2228.                                     'id'        => 'av-medium-columns',
  2229.                                     'type'      => 'select',
  2230.                                     'subtype'   => $subtype,
  2231.                                     'std'       => ''
  2232.                                 ),
  2233.                                    
  2234.                             array( 
  2235.                                     'name'      => __( 'Column count for small screens (between 480px and 767px - eg: Tablet Portrait)', 'avia_framework' ),
  2236.                                     'id'        => 'av-small-columns',
  2237.                                     'type'      => 'select',
  2238.                                     'subtype'   => $subtype,
  2239.                                     'std'       => ''
  2240.                                 ),
  2241.                                    
  2242.                             array( 
  2243.                                     'name'      => __( 'Column count for very small screens (smaller than 479px - eg: Smartphone Portrait)', 'avia_framework' ),
  2244.                                     'id'        => 'av-mini-columns',
  2245.                                     'type'      => 'select',
  2246.                                     'subtype'   => $subtype,
  2247.                                     'std'       => ''
  2248.                                 ),     
  2249.                              
  2250.                 );
  2251.            
  2252.             return $template;
  2253.         }
  2254.        
  2255.         /**
  2256.          * Select box for <h. > tag and inputfield for custom class
  2257.          *
  2258.          * @since 4.5.7.2
  2259.          * @param array $element
  2260.          * @return array
  2261.          */
  2262.         protected function heading_tag( array $element )
  2263.         {
  2264.             $setting = Avia_Builder()->get_developer_settings( 'heading_tags' );
  2265.             $class = in_array( $setting, array( 'deactivate', 'hide' ) ) ? 'avia-hidden' : '';
  2266.            
  2267.             $allowed = array(
  2268.                             __( 'Theme default', 'avia_framework' ) => '',
  2269.                             'H1'    => 'h1',
  2270.                             'H2'    => 'h2',
  2271.                             'H3'    => 'h3',
  2272.                             'H4'    => 'h4',
  2273.                             'H5'    => 'h5',
  2274.                             'H6'    => 'h6',
  2275.                             'P'     => 'p',
  2276.                             'DIV'   => 'div',
  2277.                             'SPAN'  => 'span'
  2278.                         );
  2279.            
  2280.            
  2281.             $rendered_subtype = isset( $element['subtype'] ) ? $element['subtype'] : $allowed;
  2282.             $default = isset( $element['theme_default'] ) ? $element['theme_default'] : array_keys( $rendered_subtype )[0];
  2283.            
  2284.             /**
  2285.              * Filter possible tags for element
  2286.              *
  2287.              * @since 4.5.7.2
  2288.              * @param array $rendered_subtype
  2289.              * @param array $element
  2290.              * @return array
  2291.              */
  2292.             $subtype = apply_filters( 'avf_alb_element_heading_tags', $rendered_subtype, $element );
  2293.             if( ! is_array( $subtype ) || empty( $subtype ) )
  2294.             {
  2295.                 $subtype = $rendered_subtype;
  2296.             }
  2297.            
  2298.             $std = isset( $element['std'] ) ? $element['std'] : '';
  2299.             if( ! in_array( $std, $subtype ) )
  2300.             {
  2301.                 $std = ( 1 == count( $subtype ) ) ? array_values( $subtype )[0] : array_values( $subtype )[1];
  2302.             }
  2303.            
  2304.             $template = array();
  2305.                
  2306.             $templ = array(
  2307.                             'name'              => sprintf( __( 'Heading Tag (Theme Default is &lt;%s&gt;)', 'avia_framework' ), $default ),
  2308.                             'desc'              => __( 'Select a heading tag for this element. Enfold only provides CSS for theme default tags, so it might be necessary to add a custom CSS class below and adjust the CSS rules for this element.', 'avia_framework' ),
  2309.                             'id'                => 'heading_tag',
  2310.                             'container_class'   => $class,
  2311.                             'type'              => 'select',
  2312.                             'subtype'           => $subtype,
  2313.                             'std'               => $std
  2314.                         );
  2315.            
  2316.             if( isset( $element['required'] ) && is_array( $element['required'] ) )
  2317.             {
  2318.                 $templ['required'] = $element['required'];
  2319.             }
  2320.            
  2321.             $template[] = $templ;
  2322.                
  2323.             $templ = array(
  2324.                             'name'              => __( 'Custom CSS Class For Heading Tag', 'avia_framework' ),
  2325.                             'desc'              => __( 'Add a custom css class for the heading here. Make sure to only use allowed characters (latin characters, underscores, dashes and numbers).', 'avia_framework' ),
  2326.                             'id'                => 'heading_class',
  2327.                             'container_class'   => $class,
  2328.                             'type'              => 'input',
  2329.                             'std'               => ''
  2330.                         );
  2331.            
  2332.             if( isset( $element['required'] ) && is_array( $element['required'] ) )
  2333.             {
  2334.                 $templ['required'] = $element['required'];
  2335.             }
  2336.            
  2337.             $template[] = $templ;
  2338.            
  2339.             return $template;
  2340.         }
  2341.        
  2342.         /**
  2343.          * Lazy Load Template
  2344.          *
  2345.          * @since 4.7.6.3
  2346.          * @deprecated 4.7.6.4
  2347.          * @param array $element
  2348.          * @return array
  2349.          */
  2350.         protected function lazy_loading( array $element )
  2351.         {
  2352.             _deprecated_function( 'Avia_Popup_Templates::lazy_loading', '4.7.6.4', 'Avia_Popup_Templates::lazy_loading_toggle' );
  2353.            
  2354.             $element['no_toggle'] = true;
  2355.            
  2356.             return $this->lazy_loading_toggle( $element );
  2357.         }
  2358.        
  2359.         /**
  2360.          * Lazy Load Template
  2361.          *
  2362.          * @since 4.7.6.4
  2363.          * @param array $element
  2364.          * @return array
  2365.          */
  2366.         protected function lazy_loading_toggle( array $element )
  2367.         {
  2368.             $desc  = __( 'Lazy loading of images using pure HTML is a feature introduced with WP 5.5 as a standard feature to speed up page loading. But it may not be compatible with animations and might break functionality of your page.', 'avia_framework' ) . ' ';
  2369.             $desc .= __( 'Therefore this feature is disabled by default. Please check carefully that everything is working as you expect when you enable this feature for this element.', 'avia_framework' );
  2370.                    
  2371.             $id = isset( $element['id'] ) && ! empty( $element['id'] ) ? $element['id'] : 'lazy_loading';
  2372.             $std = isset( $element['std'] ) && in_array( $element['std'] , array( 'disabled', 'enabled' ) ) ? $element['std'] : 'disabled';
  2373.             $required = isset( $element['required'] ) && is_array( $element['required'] ) ? $element['required'] : array();
  2374.            
  2375.             $c = array(
  2376.                             array(
  2377.                                 'name'      => __( 'Lazy Loading Of Images', 'avia_framework' ),
  2378.                                 'desc'      => $desc,
  2379.                                 'id'        => $id,
  2380.                                 'type'      => 'select',
  2381.                                 'std'       => $std,
  2382.                                 'required'  => $required,
  2383.                                 'subtype'   => array(
  2384.                                                     __( 'Do not use lazy loading', 'avia_framework' )   => 'disabled',
  2385.                                                     __( 'Enable lazy loading', 'avia_framework' )       => 'enabled'
  2386.                                                 )
  2387.                             )
  2388.                 );
  2389.            
  2390.             if( isset( $element['no_toggle'] ) && true === $element['no_toggle'] )
  2391.             {
  2392.                 $template = $c;
  2393.             }
  2394.             else
  2395.             {
  2396.                 $template = array(
  2397.                                 array( 
  2398.                                     'type'          => 'template',
  2399.                                     'template_id'   => 'toggle',
  2400.                                     'title'         => __( 'Performance', 'avia_framework' ),
  2401.                                     'content'       => $c
  2402.                                 ),
  2403.                     );
  2404.             }
  2405.            
  2406.             return $template;
  2407.         }
  2408.        
  2409.        
  2410.        
  2411.         /**
  2412.          *  Select boxes for WooCommerce Options for non product elements
  2413.          *
  2414.          * @since 4.5.7.1
  2415.          * @param array $element
  2416.          * @return array
  2417.          */
  2418.         protected function wc_options_non_products( array $element )
  2419.         {
  2420.             $required = array( 'link', 'parent_in_array', implode( ' ', get_object_taxonomies( 'product', 'names' ) ) );
  2421.            
  2422.             $sort = array(
  2423.                             __( 'Use default (defined at Dashboard -&gt; Customize -&gt; WooCommerce)', 'avia_framework' )  => '',
  2424.                             __( 'Sort alphabetically', 'avia_framework' )           => 'title',
  2425.                             __( 'Sort by most recent', 'avia_framework' )           => 'date',
  2426.                             __( 'Sort by price', 'avia_framework' )                 => 'price',
  2427.                             __( 'Sort by popularity', 'avia_framework' )            => 'popularity',
  2428.                             __( 'Sort randomly', 'avia_framework' )                 => 'rand',
  2429.                             __( 'Sort by menu order and name', 'avia_framework' )   => 'menu_order',
  2430.                             __( 'Sort by average rating', 'avia_framework' )        => 'rating',
  2431.                             __( 'Sort by relevance', 'avia_framework' )             => 'relevance',
  2432.                             __( 'Sort by Product ID', 'avia_framework' )            => 'id'
  2433.                         );
  2434.            
  2435.             /**
  2436.              * @since 4.5.7.1
  2437.              * @param array $sort
  2438.              * @param array $element
  2439.              * @return array
  2440.              */
  2441.             $sort = apply_filters( 'avf_alb_wc_options_non_products_sort', $sort, $element );
  2442.            
  2443.            
  2444.             $template = array();
  2445.            
  2446.             $template[] = array(
  2447.                                 'name'      => __( 'WooCommerce Out of Stock Product visibility', 'avia_framework' ),
  2448.                                 'desc'      => __( 'Select the visibility of WooCommerce products. Default setting can be set at Woocommerce -&gt Settings -&gt Products -&gt Inventory -&gt Out of stock visibility', 'avia_framework' ),
  2449.                                 'id'        => 'wc_prod_visible',
  2450.                                 'type'      => 'select',
  2451.                                 'std'       => '',
  2452.                                 'required'  => $required,
  2453.                                 'subtype'   => array(
  2454.                                                     __( 'Use default WooCommerce Setting (Settings -&gt; Products -&gt; Out of stock visibility)', 'avia_framework' ) => '',
  2455.                                                     __( 'Hide products out of stock', 'avia_framework' )    => 'hide',
  2456.                                                     __( 'Show products out of stock', 'avia_framework' )    => 'show'
  2457.                                                 )
  2458.                             );
  2459.            
  2460.             $template[] = array(
  2461.                                 'name'      => __( 'WooCommerce Hidden Products visibility', 'avia_framework' ),
  2462.                                 'desc'      => __( 'Select the visibility of WooCommerce products depending on catalog visibility. Can be set independently for each product: Edit Product -&gt Publish panel -&gt Catalog visibility', 'avia_framework' ),
  2463.                                 'id'        => 'wc_prod_hidden',
  2464.                                 'type'      => 'select',
  2465.                                 'std'       => 'hide',
  2466.                                 'required'  => $required,
  2467.                                 'subtype'   => array(
  2468.                                                     __( 'Show all products', 'avia_framework' )         => '',
  2469.                                                     __( 'Hide hidden products', 'avia_framework' )      => 'hide',
  2470.                                                     __( 'Show hidden products only', 'avia_framework' ) => 'show'
  2471.                                                 )
  2472.                             );
  2473.            
  2474.             $template[] = array(
  2475.                                 'name'      => __( 'WooCommerce Featured Products visibility', 'avia_framework' ),
  2476.                                 'desc'      => __( 'Select the visibility of WooCommerce products depending on checkbox &quot;This is a featured product&quot; in catalog visibility. Can be set independently for each product: Edit Product -&gt Publish panel -&gt Catalog visibility', 'avia_framework' ),
  2477.                                 'id'        => 'wc_prod_featured',
  2478.                                 'type'      => 'select',
  2479.                                 'std'       => '',
  2480.                                 'required'  => $required,
  2481.                                 'subtype'   => array(
  2482.                                                     __( 'Show all products', 'avia_framework' )             => '',
  2483.                                                     __( 'Hide featured products', 'avia_framework' )        => 'hide',
  2484.                                                     __( 'Show featured products only', 'avia_framework' )   => 'show'
  2485.                                                 )
  2486.                             );
  2487.                    
  2488.             $template[] = array(
  2489.                                 'name'      => __( 'WooCommerce Sorting Options', 'avia_framework' ),
  2490.                                 'desc'      => __( 'Here you can choose how to sort the products. Default setting can be set at Dashboard -&gt; Appearance -&gt; Customize -&gt; WooCommerce -&gt; Product Catalog -&gt; Default Product Sorting', 'avia_framework' ),
  2491.                                 'id'        => 'prod_order_by',
  2492.                                 'type'      => 'select',
  2493.                                 'std'       => '',
  2494.                                 'required'  => $required,
  2495.                                 'subtype'   => $sort
  2496.                             );
  2497.                
  2498.             $template[] = array(
  2499.                                 'name'      => __( 'WooCommerce Sorting Order', 'avia_framework' ),
  2500.                                 'desc'      => __( 'Here you can choose the order of the result products. Default setting can be set at Dashboard -&gt; Appearance -&gt; Customize -&gt; WooCommerce -&gt; Product Catalog -&gt; Default Product Sorting', 'avia_framework' ),
  2501.                                 'id'        => 'prod_order',
  2502.                                 'type'      => 'select',
  2503.                                 'std'       => '',
  2504.                                 'required'  => $required,
  2505.                                 'subtype'   => array(
  2506.                                                     __( 'Use default (defined at Dashboard -&gt; Customize -&gt; WooCommerce)', 'avia_framework' ) => '',
  2507.                                                     __( 'Ascending', 'avia_framework' )         => 'ASC',
  2508.                                                     __( 'Descending', 'avia_framework' )        => 'DESC'
  2509.                                                 )
  2510.                             );
  2511.            
  2512.             return $template;
  2513.         }
  2514.        
  2515.        
  2516.         /**
  2517.          *  Select boxes for WooCommerce Options for product elements
  2518.          *
  2519.          * @since 4.5.7.1
  2520.          * @param array $element
  2521.          * @return array
  2522.          */
  2523.         protected function wc_options_products( array $element )
  2524.         {
  2525.            
  2526.             $sort = array(
  2527.                             __( 'Use default (defined at Dashboard -&gt; Customize -&gt; WooCommerce)', 'avia_framework' )  => '0',
  2528.                             __( 'Sort alphabetically', 'avia_framework' )           => 'title',
  2529.                             __( 'Sort by most recent', 'avia_framework' )           => 'date',
  2530.                             __( 'Sort by price', 'avia_framework' )                 => 'price',
  2531.                             __( 'Sort by popularity', 'avia_framework' )            => 'popularity',
  2532.                             __( 'Sort randomly', 'avia_framework' )                 => 'rand',
  2533.                             __( 'Sort by menu order and name', 'avia_framework' )   => 'menu_order',
  2534.                             __( 'Sort by average rating', 'avia_framework' )        => 'rating',
  2535.                             __( 'Sort by relevance', 'avia_framework' )             => 'relevance',
  2536.                             __( 'Sort by Product ID', 'avia_framework' )            => 'id'
  2537.                         );
  2538.            
  2539.             $sort_std = '0';
  2540.            
  2541.             if( ! empty( $element['sort_dropdown'] ) )
  2542.             {
  2543.                 $sort = array_merge( array( __( 'Let user pick by displaying a dropdown with sort options (default value is defined at Default product sorting)', 'avia_framework' ) => 'dropdown' ), $sort );
  2544.                 $sort_std = 'dropdown';
  2545.             }
  2546.            
  2547.             /**
  2548.              * @since 4.5.7.1
  2549.              * @param array $sort
  2550.              * @param array $element
  2551.              * @return array
  2552.              */
  2553.             $sort = apply_filters( 'avf_alb_wc_options_non_products_sort', $sort, $element );
  2554.            
  2555.             $template = array();
  2556.            
  2557.             $template[] = array(
  2558.                                 'name'      => __( 'WooCommerce Out of Stock Product visibility', 'avia_framework' ),
  2559.                                 'desc'      => __( 'Select the visibility of WooCommerce products. Default setting can be set at Woocommerce -&gt Settings -&gt Products -&gt Inventory -&gt Out of stock visibility', 'avia_framework' ),
  2560.                                 'id'        => 'wc_prod_visible',
  2561.                                 'type'      => 'select',
  2562.                                 'std'       => '',
  2563.                                 'subtype'   => array(
  2564.                                                     __( 'Use default WooCommerce Setting (Settings -&gt; Products -&gt; Out of stock visibility)', 'avia_framework' ) => '',
  2565.                                                     __( 'Hide products out of stock', 'avia_framework' )    => 'hide',
  2566.                                                     __( 'Show products out of stock', 'avia_framework' )    => 'show'
  2567.                                                 )
  2568.                             );
  2569.                    
  2570.                
  2571.             $template[] = array(
  2572.                                 'name'      => __( 'WooCommerce Hidden Products visibility', 'avia_framework' ),
  2573.                                 'desc'      => __( 'Select the visibility of WooCommerce products depending on catalog visibility. Can be set independently for each product: Edit Product -&gt Publish panel -&gt Catalog visibility', 'avia_framework' ),
  2574.                                 'id'        => 'wc_prod_hidden',
  2575.                                 'type'      => 'select',
  2576.                                 'std'       => '',
  2577.                                 'subtype'   => array(
  2578.                                                     __( 'Show all products', 'avia_framework' )         => '',
  2579.                                                     __( 'Hide hidden products', 'avia_framework' )      => 'hide',
  2580.                                                     __( 'Show hidden products only', 'avia_framework' ) => 'show'
  2581.                                                 )
  2582.                             );
  2583.                
  2584.             $template[] = array(
  2585.                                 'name'      => __( 'WooCommerce Featured Products visibility', 'avia_framework' ),
  2586.                                 'desc'      => __( 'Select the visibility of WooCommerce products depending on checkbox &quot;This is a featured product&quot; in catalog visibility. Can be set independently for each product: Edit Product -&gt Publish panel -&gt Catalog visibility', 'avia_framework' ),
  2587.                                 'id'        => 'wc_prod_featured',
  2588.                                 'type'      => 'select',
  2589.                                 'std'       => '',
  2590.                                 'subtype'   => array(
  2591.                                                     __( 'Show all products', 'avia_framework' )             => '',
  2592.                                                     __( 'Hide featured products', 'avia_framework' )        => 'hide',
  2593.                                                     __( 'Show featured products only', 'avia_framework' )   => 'show'
  2594.                                                 )
  2595.                             );
  2596.                
  2597.             $template[] = array(
  2598.                                 'name'      => __( 'WooCommerce Sidebar Filters', 'avia_framework' ),
  2599.                                 'desc'      => __( 'Allow to filter products for this element using the 3 WooCommerce sidebar filters: Filter Products by Price, Rating, Attribute. These filters are only shown on the selected WooCommerce Shop page (WooCommerce -&gt; Settings -&gt; Products -&gt; General -&gt; Shop Page) or on product category pages. You may also use a custom widget area for the sidebar.', 'avia_framework' ),
  2600.                                 'id'        => 'wc_prod_additional_filter',
  2601.                                 'type'      => 'select',
  2602.                                 'std'       => '',
  2603.                                 'subtype'   => array(
  2604.                                                     __( 'Ignore filters', 'avia_framework' )    => '',
  2605.                                                     __( 'Use filters', 'avia_framework' )       => 'use_additional_filter'
  2606.                                                 )
  2607.                             );     
  2608.            
  2609.             $template[] = array(
  2610.                                 'name'      => __( 'WooCommerce Sorting Options', 'avia_framework' ),
  2611.                                 'desc'      => __( 'Here you can choose how to sort the products. Default setting can be set at Dashboard -&gt; Appearance -&gt; Customize -&gt; WooCommerce -&gt; Product Catalog -&gt; Default Product Sorting', 'avia_framework' ),
  2612.                                 'id'        => 'sort',
  2613.                                 'type'      => 'select',
  2614.                                 'std'       => $sort_std,
  2615.                                 'subtype'   => $sort
  2616.                             );
  2617.                                    
  2618.             $template[] = array(
  2619.                                 'name'      => __( 'WooCommerce Sorting Order', 'avia_framework' ),
  2620.                                 'desc'      => __( 'Here you can choose the order of the result products. Default setting can be set at Dashboard -&gt; Appearance -&gt; Customize -&gt; WooCommerce -&gt; Product Catalog -&gt; Default Product Sorting', 'avia_framework' ),
  2621.                                 'id'        => 'prod_order',
  2622.                                 'type'      => 'select',
  2623.                                 'std'       => '',
  2624.                                 'subtype'   => array(
  2625.                                                     __( 'Use default (defined at Dashboard -&gt; Customize -&gt; WooCommerce)', 'avia_framework' ) => '',
  2626.                                                     __( 'Ascending', 'avia_framework' )         => 'ASC',
  2627.                                                     __( 'Descending', 'avia_framework' )        => 'DESC'
  2628.                                                 )
  2629.                             );
  2630.            
  2631.             return $template;
  2632.         }
  2633.        
  2634.         /**
  2635.          * Adds theme defined html templates for ALB
  2636.          *
  2637.          * @since 4.6.4
  2638.          */
  2639.         protected function set_predefined_html_templates()
  2640.         {
  2641.             $c  = '';
  2642.            
  2643.             $c .=   '<div class="avia-flex-element">';
  2644.             $c .=       __( 'This element will stretch across the whole screen by default.', 'avia_framework' ) . '<br/>';
  2645.             $c .=       __( 'If you put it inside a color section or column it will only take up the available space', 'avia_framework' );
  2646.             $c .=       '<div class="avia-flex-element-2nd">' . __( 'Currently:', 'avia_framework' );
  2647.             $c .=           '<span class="avia-flex-element-stretched">&laquo; ' . __( 'Stretch fullwidth', 'avia_framework') . ' &raquo;</span>';
  2648.             $c .=           '<span class="avia-flex-element-content">| ' . __( 'Adjust to content width', 'avia_framework' ) . ' |</span>';
  2649.             $c .=       '</div>';
  2650.             $c .=   '</div>';
  2651.            
  2652.             $this->html_templates['alb_element_fullwidth_stretch'] = $c;
  2653.         }
  2654.    
  2655.     }
  2656.    
  2657.     /**
  2658.      * Returns the main instance of Avia_Popup_Templates to prevent the need to use globals
  2659.      *
  2660.      * @since 4.3.2
  2661.      * @return Avia_Popup_Templates
  2662.      */
  2663.     function AviaPopupTemplates()
  2664.     {
  2665.         return Avia_Popup_Templates::instance();
  2666.     }
  2667.    
  2668. }       //  end Avia_Popup_Templates
  2669.  
  2670.  
Add Comment
Please, Sign In to add comment