',
'template_id' => 'element_template_selection_tab',
'args' => array( 'sc' => $this )
),
array(
'type' => 'tab_container_close',
'nodescription' => true
),
array(
'id' => 'av_element_hidden_in_editor',
'type' => 'hidden',
'std' => '0'
),
);
}
/**
* Create and register templates for easier maintainance
*
* @since 4.6.4
*/
protected function register_dynamic_templates()
{
global $avia_config;
/**
* Layout Tab
* ===========
*/
$c = array(
array(
'name' => __( 'Section Minimum Height','avia_framework' ),
'id' => 'min_height',
'desc' => __( 'Define a minimum height for the section. Content within the section will be centered vertically within the section', 'avia_framework' ),
'type' => 'select',
'std' => '',
'lockable' => true,
'subtype' => array(
__( 'No minimum height, use content within section to define Section height', 'avia_framework' ) => '',
__( 'At least 100% of Browser Window height', 'avia_framework' ) => '100',
__( 'At least 75% of Browser Window height', 'avia_framework' ) => '75',
__( 'At least 50% of Browser Window height', 'avia_framework' ) => '50',
__( 'At least 25% of Browser Window height', 'avia_framework' ) => '25',
__( 'Custom height in % based on browser windows height', 'avia_framework' ) => 'percent',
__( 'Custom height in pixel', 'avia_framework' ) => 'custom',
)
),
array(
'name' => __( 'Section minimum custom height in %', 'avia_framework' ),
'desc' => __( 'Define a minimum height for the section in % based on the browser windows height', 'avia_framework' ),
'id' => 'min_height_pc',
'type' => 'select',
'std' => '25',
'lockable' => true,
'required' => array( 'min_height', 'equals', 'percent' ),
'subtype' => AviaHtmlHelper::number_array( 1, 99, 1 )
),
array(
'name' => __( 'Section custom height', 'avia_framework' ),
'desc' => __( 'Define a minimum height for the section. Use a pixel value. eg: 500px', 'avia_framework' ) ,
'id' => 'min_height_px',
'type' => 'input',
'std' => '500px',
'lockable' => true,
'required' => array( 'min_height', 'equals', 'custom' ),
)
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Section Height', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'layout_section_height' ), $template );
$c = array(
array(
'name' => __( 'Section Padding', 'avia_framework' ),
'id' => 'padding',
'desc' => __( 'Define the sections top and bottom padding', 'avia_framework' ),
'type' => 'select',
'std' => 'default',
'lockable' => true,
'subtype' => array(
__( 'No Padding', 'avia_framework' ) => 'no-padding',
__( 'Small Padding', 'avia_framework' ) => 'small',
__( 'Default Padding', 'avia_framework' ) => 'default',
__( 'Large Padding', 'avia_framework' ) => 'large',
__( 'Huge Padding', 'avia_framework' ) => 'huge',
)
),
array(
'name' => __( 'Custom top and bottom margin', 'avia_framework' ),
'desc' => __( 'If checked allows you to set a custom top and bottom margin. Otherwise the margin is calculated by the theme based on surrounding elements', 'avia_framework' ),
'id' => 'margin',
'type' => 'checkbox',
'std' => '',
'lockable' => true,
),
array(
'name' => __( 'Custom top and bottom margin', 'avia_framework' ),
'desc' => __( 'Set a custom top or bottom margin. Both pixel and % based values are accepted. eg: 30px, 5%', 'avia_framework' ),
'id' => 'custom_margin',
'type' => 'multi_input',
'sync' => true,
'std' => '0px',
'lockable' => true,
'required' => array( 'margin', 'not','' ),
'multi' => array(
'top' => __( 'Margin-Top', 'avia_framework' ),
'bottom' => __( 'Margin-Bottom', 'avia_framework' ),
)
)
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Margin and Padding', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'layout_margin_padding' ), $template );
$template = array(
array(
'type' => 'template',
'template_id' => 'svg_divider_toggle',
'lockable' => true
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'layout_svg_dividers' ), $template );
/**
* Styling Tab
* ===========
*/
$c = array(
array(
'name' => __( 'Section Colors', 'avia_framework' ),
'desc' => __( 'The section will use the color scheme you select. Color schemes are defined on your styling page', 'avia_framework' ) .
'
' . __( '(Show Styling Page)', 'avia_framework' ) . '',
'id' => 'color',
'type' => 'select',
'std' => 'main_color',
'lockable' => true,
'subtype' => array_flip( $avia_config['color_sets'] )
),
array(
'name' => __( 'Background', 'avia_framework' ),
'desc' => __( 'Select the type of background for the column.', 'avia_framework' ),
'id' => 'background',
'type' => 'select',
'std' => 'bg_color',
'lockable' => true,
'subtype' => array(
__( 'Background Color', 'avia_framework' ) => 'bg_color',
__( 'Background Gradient', 'avia_framework' ) => 'bg_gradient',
)
),
array(
'name' => __( 'Custom Background Color', 'avia_framework' ),
'desc' => __( 'Select a custom background color for this cell here. Leave empty for default color', 'avia_framework' ),
'id' => 'custom_bg',
'type' => 'colorpicker',
'rgba' => true,
'std' => '',
'lockable' => true,
'required' => array( 'background', 'equals', 'bg_color' )
),
array(
'type' => 'template',
'template_id' => 'gradient_colors',
'id' => array( 'background_gradient_direction', 'background_gradient_color1', 'background_gradient_color2', 'background_gradient_color3' ),
'lockable' => true,
'required' => array( 'background', 'equals', 'bg_gradient' ),
'container_class' => array( '', 'av_third av_third_first', 'av_third', 'av_third' ),
)
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Background Colors', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_background_colors' ), $template );
$c = array(
array(
'name' => __( 'Custom Background Image', 'avia_framework' ),
'desc' => __( 'Either upload a new, or choose an existing image from your media library. Leave empty if you want to use the background image of the color scheme defined above', 'avia_framework' ),
'id' => 'src',
'type' => 'image',
'title' => __( 'Insert Image', 'avia_framework' ),
'button' => __( 'Insert', 'avia_framework' ),
'std' => '',
'lockable' => true,
'locked' => array( 'src', 'attachment', 'attachment_size' )
),
array(
'name' => __( 'Background Attachment', 'avia_framework' ),
'desc' => __( 'Background can either scroll with the page, be fixed or scroll with a parallax motion', 'avia_framework' ),
'id' => 'attach',
'type' => 'select',
'std' => 'scroll',
'lockable' => true,
'required' => array( 'src', 'not', '' ),
'subtype' => array(
__( 'Scroll', 'avia_framework' ) => 'scroll',
__( 'Fixed', 'avia_framework' ) => 'fixed',
__( 'Parallax', 'avia_framework' ) => 'parallax'
)
),
array(
'type' => 'template',
'template_id' => 'background_image_position',
'args' => array(
'id_pos' => 'position',
'id_repeat' => 'repeat'
),
'lockable' => true
)
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Background Image', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_background_image' ), $template );
$c = array(
array(
'name' => __( 'Background Video', 'avia_framework' ),
'desc' => __( 'You can also place a video as background for your section. Enter the URL to the Video. Currently supported are Youtube, Vimeo and direct linking of web-video files (mp4, webm, ogv)', 'avia_framework' ) . '
' .
__( 'Working examples Youtube & Vimeo:', 'avia_framework' ) . '
http://vimeo.com/1084537
http://www.youtube.com/watch?v=5guMumPFBag
',
'id' => 'video',
'type' => 'input',
'std' => '',
'lockable' => true
),
array(
'name' => __( 'Video Aspect Ratio', 'avia_framework' ),
'desc' => __( 'In order to calculate the correct height and width for the video slide you need to enter a aspect ratio (width:height). usually: 16:9 or 4:3.', 'avia_framework' ) . '
' . __( 'If left empty 16:9 will be used', 'avia_framework' ) ,
'id' => 'video_ratio',
'type' => 'input',
'std' => '16:9',
'lockable' => true,
'required' => array( 'video', 'not', '' ),
),
array(
'name' => __( 'Hide video on Mobile Devices?', 'avia_framework' ),
'desc' => __( 'You can choose to hide the video entirely on Mobile devices and instead display the Section Background image', 'avia_framework' ) . '
' . __( "Most mobile devices can't autoplay videos to prevent bandwidth problems for the user", 'avia_framework' ) . '' ,
'id' => 'video_mobile_disabled',
'type' => 'checkbox',
'std' => '',
'lockable' => true,
'required' => array( 'video', 'not', '' ),
)
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Background Video', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_background_video' ), $template );
$c = array(
array(
'name' => __( 'Enable Overlay?', 'avia_framework' ),
'desc' => __( 'Check if you want to display a transparent color and/or pattern overlay above your section background image/video', 'avia_framework' ),
'id' => 'overlay_enable',
'type' => 'checkbox',
'std' => '',
'lockable' => true,
),
array(
'name' => __( 'Overlay Opacity', 'avia_framework' ),
'desc' => __( 'Set the opacity of your overlay: 0.1 is barely visible, 1.0 is opaque ', 'avia_framework' ),
'id' => 'overlay_opacity',
'type' => 'select',
'std' => '0.5',
'lockable' => true,
'required' => array( 'overlay_enable', 'not', '' ),
'subtype' => array(
__( '0.1', 'avia_framework' ) => '0.1',
__( '0.2', 'avia_framework' ) => '0.2',
__( '0.3', 'avia_framework' ) => '0.3',
__( '0.4', 'avia_framework' ) => '0.4',
__( '0.5', 'avia_framework' ) => '0.5',
__( '0.6', 'avia_framework' ) => '0.6',
__( '0.7', 'avia_framework' ) => '0.7',
__( '0.8', 'avia_framework' ) => '0.8',
__( '0.9', 'avia_framework' ) => '0.9',
__( '1.0', 'avia_framework' ) => '1',
)
),
array(
'name' => __( 'Overlay Color', 'avia_framework' ),
'desc' => __( 'Select a custom color for your overlay here. Leave empty if you want no color overlay', 'avia_framework' ),
'id' => 'overlay_color',
'type' => 'colorpicker',
'std' => '',
'lockable' => true,
'required' => array( 'overlay_enable', 'not', '' )
),
array(
'name' => __( 'Background Image', 'avia_framework' ),
'desc' => __( 'Select an existing or upload a new background image', 'avia_framework' ),
'id' => 'overlay_pattern',
'type' => 'select',
'std' => '',
'folder' => 'images/background-images/',
'folderlabel' => '',
'group' => __( 'Select predefined pattern', 'avia_framework' ),
'exclude' => array( 'fullsize-', 'gradient' ),
'lockable' => true,
'required' => array( 'overlay_enable', 'not', '' ),
'subtype' => array(
__( 'No Background Image', 'avia_framework' ) => '',
__( 'Upload custom image', 'avia_framework' ) => 'custom'
)
),
array(
'name' => __( 'Custom Pattern', 'avia_framework' ),
'desc' => __( 'Upload your own seamless pattern', 'avia_framework' ),
'id' => 'overlay_custom_pattern',
'type' => 'image',
'fetch' => 'url',
'secondary_img' => true,
'title' => __( 'Insert Pattern', 'avia_framework' ),
'button' => __( 'Insert', 'avia_framework' ),
'std' => '',
'lockable' => true,
'required' => array( 'overlay_pattern', 'equals', 'custom' )
),
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Background Overlay', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_background_overlay' ), $template );
$c = array(
array(
'name' => __( 'Section Top Border Styling', 'avia_framework' ),
'desc' => __( 'Choose a border styling for the top of your section', 'avia_framework' ),
'id' => 'shadow',
'type' => 'select',
'std' => 'no-border-styling',
'lockable' => true,
'subtype' => array(
__( 'Display a simple 1px top border', 'avia_framework' ) => 'no-shadow',
__( 'Display a small styling shadow at the top of the section', 'avia_framework' ) => 'shadow',
__( 'No border styling', 'avia_framework' ) => 'no-border-styling',
)
),
array(
'name' => __( 'Section Bottom Border Styling', 'avia_framework' ),
'desc' => __( 'Choose a border styling for the bottom of your section', 'avia_framework' ),
'id' => 'bottom_border',
'type' => 'select',
'std' => 'no-border-styling',
'lockable' => true,
'subtype' => array(
__( 'No border styling', 'avia_framework' ) => 'no-border-styling',
__( 'Display a small arrow that points down to the next section', 'avia_framework' ) => 'border-extra-arrow-down',
__( 'Diagonal section border', 'avia_framework' ) => 'border-extra-diagonal',
)
),
array(
'name' => __( 'Diagonal Border: Color', 'avia_framework' ),
'desc' => __( 'Select a custom background color for your Section border here.', 'avia_framework' ),
'id' => 'bottom_border_diagonal_color',
'type' => 'colorpicker',
'std' => '#333333',
'container_class' => 'av_third av_third_first',
'lockable' => true,
'required' => array( 'bottom_border', 'contains', 'diagonal' )
),
array(
'name' => __( 'Diagonal Border: Direction','avia_framework' ),
'desc' => __( 'Set the direction of the diagonal border', 'avia_framework' ),
'id' => 'bottom_border_diagonal_direction',
'type' => 'select',
'std' => '',
'container_class' => 'av_third',
'lockable' => true,
'required' => array( 'bottom_border', 'contains', 'diagonal' ),
'subtype' => array(
__( 'Slanting from left to right', 'avia_framework' ) => '',
__( 'Slanting from right to left', 'avia_framework' ) => 'border-extra-diagonal-inverse'
)
),
array(
'name' => __( 'Diagonal Border Box Style', 'avia_framework' ),
'desc' => __( 'Set the style shadow of the border', 'avia_framework' ),
'id' => 'bottom_border_style',
'type' => 'select',
'std' => '',
'container_class' => 'av_third',
'lockable' => true,
'required' => array( 'bottom_border', 'contains', 'diagonal' ),
'subtype' => array(
__( 'Minimal', 'avia_framework' ) => '',
__( 'Box shadow', 'avia_framework' ) => 'diagonal-box-shadow'
)
)
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Borders', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_borders' ), $template );
$c = array(
array(
'name' => __( 'Display a scroll down arrow', 'avia_framework' ),
'desc' => __( 'Check if you want to show a button at the bottom of the section that takes the user to the next section by scrolling down', 'avia_framework' ) ,
'id' => 'scroll_down',
'type' => 'checkbox',
'std' => '',
'lockable' => true
),
array(
'name' => __( 'Custom Arrow Color', 'avia_framework' ),
'desc' => __( 'Select a custom arrow color. Leave empty if you want to use the default arrow color and style', 'avia_framework' ),
'id' => 'custom_arrow_bg',
'type' => 'colorpicker',
'std' => '',
'lockable' => true,
'required' => array( 'scroll_down', 'not', '' ),
)
);
$template = array(
array(
'type' => 'template',
'template_id' => 'toggle',
'title' => __( 'Scroll Down Arrow', 'avia_framework' ),
'content' => $c
),
);
AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_arrow' ), $template );
}
/**
* Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
* Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
* Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
*
*
* @param array $params this array holds the default values for $content and $args.
* @return $params the return array usually holds an innerHtml key that holds item specific markup.
*/
function editor_element( $params )
{
$default = array();
$locked = array();
$attr = $params['args'];
$content = $params['content'];
Avia_Element_Templates()->set_locked_attributes( $attr, $this, $this->config['shortcode'], $default, $locked, $content );
$args = $attr; // => extract( $params );
$data = isset( $params['data'] ) && is_array( $params['data'] ) ? $params['data'] : array();
$data_locked = array();
$extraClass = isset( $args['element_template'] ) && $args['element_template'] > 0 ? ' element_template_selected' : ' no_element_template';
$name = $this->config['shortcode'];
$data['shortcodehandler'] = $this->config['shortcode'];
$data['modal_title'] = $this->config['name'];
$data['modal_ajax_hook'] = $this->config['shortcode'];
$data['dragdrop-level'] = $this->config['drag-level'];
$data['allowed-shortcodes'] = $this->config['shortcode'];
$data['base_shortcode'] = $this->config['shortcode'];
$data['element_title'] = $this->config['name'];
$data['element_tooltip'] = $this->config['tooltip'];
$data['preview'] = ! empty( $this->config['preview'] ) ? $this->config['preview'] : 0;
$title_id = ! empty( $args['id'] ) ? ': ' . ucfirst( $args['id'] ) : '';
foreach( $locked as $key => $value )
{
$data_locked[ 'locked_' . $key ] = $value;
}
// add background color or gradient to indicator
$el_bg = '';
if( empty( $args['background'] ) || ( $args['background'] == 'bg_color' ) )
{
$el_bg = ! empty( $args['custom_bg'] ) ? " background:{$args['custom_bg']};" : '';
}
else
{
if( $args['background_gradient_color1'] && $args['background_gradient_color2'] )
{
$el_bg = "background:linear-gradient({$args['background_gradient_color1']},{$args['background_gradient_color2']});";
}
}
$hidden_el_active = ! empty( $args['av_element_hidden_in_editor'] ) ? 'av-layout-element-closed' : '';
if( ! empty( $this->config['modal_on_load'] ) )
{
$data['modal_on_load'] = $this->config['modal_on_load'];
}
$data_locked['initial_el_bg'] = $el_bg;
$data_locked['initial_layout_element_bg'] = $this->get_bg_string( $args );
$dataString = AviaHelper::create_data_string( $data );
$dataStringLocked = AviaHelper::create_data_string( $data_locked );
$output = "
' . esc_html( $dummy_text ) . '
'; $html .= '