| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( '-1' ); |
| 4 |
} |
| 5 |
|
| 6 |
/*-----------------------------------------------------------------------------------*/ |
| 7 |
/* Icon Group |
| 8 |
/*-----------------------------------------------------------------------------------*/ |
| 9 |
|
| 10 |
class WPBakeryShortCode_borderless_wpbakery_icon_group extends WPBakeryShortCodesContainer { |
| 11 |
protected function content( $atts, $content = null ) { |
| 12 |
extract( shortcode_atts( array( |
| 13 |
'direction' => 'row', |
| 14 |
'justify_content' => 'flex-start', |
| 15 |
//Static |
| 16 |
'el_id' => '', |
| 17 |
'el_class' => '', |
| 18 |
'css' => '', |
| 19 |
'css_animation' => '' |
| 20 |
), $atts ) ); |
| 21 |
$output = ''; |
| 22 |
|
| 23 |
|
| 24 |
// Retrieve data from the database. |
| 25 |
$options = get_option( 'borderless' ); |
| 26 |
|
| 27 |
|
| 28 |
// Set default values |
| 29 |
$borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color |
| 30 |
$borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color |
| 31 |
$borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color |
| 32 |
$borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color |
| 33 |
|
| 34 |
|
| 35 |
// Default Extra Class, CSS and CSS animation |
| 36 |
$css = isset( $atts['css'] ) ? $atts['css'] : ''; |
| 37 |
$el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : ''; |
| 38 |
$el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : ''; |
| 39 |
if ( '' !== $css_animation ) { |
| 40 |
wp_enqueue_script( 'waypoints' ); |
| 41 |
$css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation; |
| 42 |
} |
| 43 |
$class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation ); |
| 44 |
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts ); |
| 45 |
|
| 46 |
|
| 47 |
// Output |
| 48 |
$output .= '<div '.$el_id.' class="borderless-wpbakery-icon-group '.$css_class.'" style="justify-content:'.$justify_content.'; flex-direction:'.$direction.'">'; |
| 49 |
$output .= wpb_js_remove_wpautop($content); |
| 50 |
$output .= '</div>'; |
| 51 |
|
| 52 |
return $output; |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
vc_map( array( |
| 58 |
'name' => __( 'Icon Group', 'borderless' ), |
| 59 |
'base' => 'borderless_wpbakery_icon_group', |
| 60 |
'icon' => plugins_url('../images/icon-group.png', __FILE__), |
| 61 |
"as_parent" => array('only' => 'borderless_wpbakery_icon'), |
| 62 |
"content_element" => true, |
| 63 |
"show_settings_on_create" => false, |
| 64 |
"is_container" => true, |
| 65 |
'category' => __( 'Borderless', 'borderless' ), |
| 66 |
'description' => __( 'Add and manage multiple icons', 'borderless' ), |
| 67 |
'params' => array( |
| 68 |
|
| 69 |
array( |
| 70 |
'type' => 'dropdown', |
| 71 |
'heading' => __( 'Direction', 'borderless' ), |
| 72 |
'param_name' => 'direction', |
| 73 |
'value' => array( |
| 74 |
__( 'Row', 'borderless' ) => 'row', |
| 75 |
__( 'Row Reverse', 'borderless' ) => 'row-reverse', |
| 76 |
__( 'Column', 'borderless' ) => 'column', |
| 77 |
__( 'Column Reverse', 'borderless' ) => 'column-reverse', |
| 78 |
), |
| 79 |
'description' => __( 'Select the direction icons list.', 'borderless' ), |
| 80 |
), |
| 81 |
|
| 82 |
array( |
| 83 |
'type' => 'dropdown', |
| 84 |
'heading' => __( 'Justify Content', 'borderless' ), |
| 85 |
'param_name' => 'justify_content', |
| 86 |
'value' => array( |
| 87 |
__( 'Left', 'borderless' ) => 'flex-start', |
| 88 |
__( 'Right', 'borderless' ) => 'flex-end', |
| 89 |
__( 'Center', 'borderless' ) => 'center', |
| 90 |
__( 'Space Around', 'borderless' ) => 'space-around', |
| 91 |
__( 'Space Between', 'borderless' ) => 'space-between', |
| 92 |
), |
| 93 |
'description' => __( 'Select icons alignment.', 'borderless' ), |
| 94 |
), |
| 95 |
|
| 96 |
vc_map_add_css_animation(), |
| 97 |
|
| 98 |
array( |
| 99 |
'type' => 'el_id', |
| 100 |
'heading' => __( 'Element ID', 'borderless' ), |
| 101 |
'param_name' => 'el_id', |
| 102 |
'description' => sprintf( __( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'borderless' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ), |
| 103 |
), |
| 104 |
|
| 105 |
array( |
| 106 |
'type' => 'textfield', |
| 107 |
'heading' => __( 'Extra class name', 'borderless' ), |
| 108 |
'param_name' => 'el_class', |
| 109 |
'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ), |
| 110 |
), |
| 111 |
|
| 112 |
array( |
| 113 |
'type' => 'css_editor', |
| 114 |
'heading' => __( 'CSS box', 'borderless' ), |
| 115 |
'param_name' => 'css', |
| 116 |
'group' => __( 'Design Options', 'borderless' ), |
| 117 |
), |
| 118 |
), |
| 119 |
"js_view" => 'VcColumnView' |
| 120 |
) ); |