PluginProbe
Borderless – Addons and Templates for Elementor / 1.1.2
Borderless – Addons and Templates for Elementor v1.1.2
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / modules / wpbakery / elements / list-group.php

list-group.php in Borderless – Addons and Templates for Elementor 1.1.2, at modules/wpbakery/elements/list-group.php

301 lines 10.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( '-1' );
4 }
5
6 /*-----------------------------------------------------------------------------------*/
7 /* List Group
8 /*-----------------------------------------------------------------------------------*/
9
10 class WPBakeryShortCode_borderless_wpbakery_list_group extends WPBakeryShortCodesContainer {
11 protected function content( $atts, $content = null ) {
12 extract( shortcode_atts( array(
13 //Static
14 'mode' => 'borderless-wpbakery-list-group-item-text',
15 'appearance' => '',
16 'direction' => 'borderless-direction-vertical',
17 'alignment' => 'borderless-align-left',
18 'el_id' => '',
19 'el_class' => '',
20 'css' => '',
21 'css_animation' => ''
22 ), $atts ) );
23 $output = '';
24
25
26 // Retrieve data from the database.
27 $options = get_option( 'borderless' );
28
29
30 // Set default values
31 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color
32 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color
33 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color
34 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color
35
36
37 // Default Extra Class, CSS and CSS animation
38 $css = isset( $atts['css'] ) ? $atts['css'] : '';
39 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
40 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
41 if ( '' !== $css_animation ) {
42 wp_enqueue_script( 'waypoints' );
43 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
44 }
45 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
46 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
47
48
49 // Output
50 $output .= '<div '.$el_id.' class="borderless-wpbakery-list-group '.$css_class.' '.$direction.' '.$appearance.' '.$alignment.' '.$mode.'">'.wpb_js_remove_wpautop($content).'</div>';
51
52 return $output;
53 }
54 }
55
56 class WPBakeryShortCode_borderless_wpbakery_list_group_item extends WPBakeryShortCode {
57 protected function content( $atts, $content = null ) {
58 extract( shortcode_atts( array(
59 'title' => '',
60 'link' => '',
61 'icon' => '',
62 'colors' => '',
63 'icon_color' => '',
64 'title_color' => '',
65 //Static
66 'el_id' => '',
67 'el_class' => '',
68 'css' => '',
69 'css_animation' => ''
70 ), $atts ) );
71 $output = '';
72
73
74 // Retrieve data from the database.
75 $options = get_option( 'borderless' );
76
77
78 // Set default values
79 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color
80 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color
81 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color
82 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color
83
84
85 // Default Extra Class, CSS and CSS animation
86 $css = isset( $atts['css'] ) ? $atts['css'] : '';
87 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
88 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
89
90 if ( '' !== $css_animation ) {
91 wp_enqueue_script( 'waypoints' );
92 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
93 }
94
95 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
96 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
97
98
99 // URL Builder
100 $link = vc_build_link( $link );
101
102
103 // Set custom values
104 $icon_color = $icon_color ? 'style=color:'.$icon_color.'' : '';
105 $title_color = $title_color ? 'style=color:'.$title_color.'' : '';
106
107 // End Custom Colors
108
109 // Start Icon
110
111 $icon = $icon ? '<i class="'.$icon.'" '.$icon_color.' aria-hidden="true"></i>' : '';
112
113 //End Icon
114
115 // Start Link
116 if($link['url'] != ''){
117 $tag = 'a';
118 $href = 'href="'.esc_attr( $link['url'] ).'"';
119 } else {
120 $tag = 'span';
121 $href = '';
122 }
123 // End Link
124
125 $output .= '<'.$tag.' '.$href.' '.$el_id.' class="borderless-wpbakery-list-group-item '.$css_class.'" '.$title_color.'>'.$icon.$title.'</'.$tag.'>';
126
127
128 return $output;
129 }
130 }
131
132 vc_map( array(
133 'name' => __( 'List Group', 'borderless' ),
134 'base' => 'borderless_wpbakery_list_group',
135 'icon' => plugins_url('../images/list-group.png', __FILE__),
136 "as_parent" => array('only' => 'borderless_wpbakery_list_group_item'),
137 "content_element" => true,
138 "show_settings_on_create" => false,
139 "is_container" => true,
140 'category' => __( 'Borderless', 'borderless' ),
141 'description' => __( 'Show a flexible and powerful list', 'borderless' ),
142 'params' => array(
143
144 array(
145 'type' => 'dropdown',
146 'heading' => __( 'List Mode', 'borderless' ),
147 'param_name' => 'mode',
148 'value' => array(
149 __( 'Text', 'borderless' ) => 'borderless-wpbakery-list-group-item-text',
150 __( 'Link', 'borderless' ) => 'borderless-wpbakery-list-group-item-link',
151 ),
152 'description' => __( 'Choose a mode for list group.', 'borderless' ),
153 ),
154
155 array(
156 'type' => 'dropdown',
157 'heading' => __( 'Appearance', 'borderless' ),
158 'param_name' => 'appearance',
159 'value' => array(
160 __( 'No Borders and Separator Lines', 'borderless' ) => '',
161 __( 'Separator Lines', 'borderless' ) => 'borderless-separator-lines',
162 __( 'Borders and Separator Lines', 'borderless' ) => 'borderless-borders-separator-lines',
163 __( 'Borders With Rounded Corners and Separator Lines', 'borderless' ) => 'borderless-borders-rounded-corners-separator-lines',
164 ),
165 'description' => __( 'Choose a appearance for list group.', 'borderless' ),
166 ),
167
168 array(
169 'type' => 'dropdown',
170 'heading' => __( 'Direction', 'borderless' ),
171 'param_name' => 'direction',
172 'value' => array(
173 __( 'Vertical', 'borderless' ) => 'borderless-direction-vertical',
174 __( 'Horizontal', 'borderless' ) => 'borderless-direction-horizontal',
175 ),
176 'description' => __( 'Choose the direction for list group.', 'borderless' ),
177 ),
178
179 array(
180 'type' => 'dropdown',
181 'heading' => __( 'Alignment', 'borderless' ),
182 'param_name' => 'alignment',
183 'value' => array(
184 __( 'Left', 'borderless' ) => 'borderless-align-left',
185 __( 'Right', 'borderless' ) => 'borderless-align-right',
186 __( 'Center', 'borderless' ) => 'borderless-align-center',
187 ),
188 'description' => __( 'Choose the alignment for list group.', 'borderless' ),
189 ),
190
191 vc_map_add_css_animation(),
192
193 array(
194 'type' => 'el_id',
195 'heading' => __( 'Element ID', 'borderless' ),
196 'param_name' => 'el_id',
197 '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>' ),
198 ),
199
200 array(
201 'type' => 'textfield',
202 'heading' => __( 'Extra class name', 'borderless' ),
203 'param_name' => 'el_class',
204 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
205 ),
206
207 array(
208 'type' => 'css_editor',
209 'heading' => __( 'CSS box', 'borderless' ),
210 'param_name' => 'css',
211 'group' => __( 'Design Options', 'borderless' ),
212 ),
213 ),
214 "js_view" => 'VcColumnView'
215 ) );
216
217 vc_map( array(
218 "name" => __("List Item", 'borderless'),
219 'description' => __( 'Display List Group Item', 'borderless' ),
220 "base" => "borderless_wpbakery_list_group_item",
221 'icon' => plugins_url('../images/list-item.png', __FILE__),
222 "content_element" => true,
223 "as_child" => array('only' => 'borderless_wpbakery_list_group'),
224 "params" => array(
225 array(
226 'type' => 'textfield',
227 'heading' => __( 'Title', 'borderless' ),
228 'param_name' => 'title',
229 ),
230
231 array(
232 'type' => 'vc_link',
233 'heading' => __( 'URL (Link)', 'borderless' ),
234 'param_name' => 'link',
235 'description' => __( 'Add link to List Item.', 'borderless' ),
236 ),
237
238 array(
239 'type' => 'iconmanager',
240 'heading' => __( 'Icon', 'borderless' ),
241 'param_name' => 'icon',
242 'description' => __( 'Select icon from library.', 'borderless' ),
243 ),
244
245 array(
246 'type' => 'dropdown',
247 'heading' => __( 'Colors', 'borderless' ),
248 'param_name' => 'colors',
249 'value' => array(
250 __( 'Preset Colors', 'borderless' ) => '',
251 __( 'Custom Colors', 'borderless' ) => 'custom',
252 ),
253 'description' => __( 'Choose a color for icons and titles.', 'borderless' ),
254 ),
255
256 array(
257 'type' => 'colorpicker',
258 'heading' => __( 'Icon Color', 'borderless' ),
259 'param_name' => 'icon_color',
260 'description' => __( 'Select custom color for icons.', 'borderless' ),
261 'dependency' => array(
262 'element' => 'colors',
263 'value' => array( 'custom' ),
264 ),
265 ),
266
267 array(
268 'type' => 'colorpicker',
269 'heading' => __( 'Title Color', 'borderless' ),
270 'param_name' => 'title_color',
271 'description' => __( 'Select custom color for titles.', 'borderless' ),
272 'dependency' => array(
273 'element' => 'colors',
274 'value' => array( 'custom' ),
275 ),
276 ),
277
278 vc_map_add_css_animation(),
279
280 array(
281 'type' => 'el_id',
282 'heading' => __( 'Element ID', 'borderless' ),
283 'param_name' => 'el_id',
284 '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>' ),
285 ),
286
287 array(
288 'type' => 'textfield',
289 'heading' => __( 'Extra class name', 'borderless' ),
290 'param_name' => 'el_class',
291 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
292 ),
293
294 array(
295 'type' => 'css_editor',
296 'heading' => __( 'CSS box', 'borderless' ),
297 'param_name' => 'css',
298 'group' => __( 'Design Options', 'borderless' ),
299 ),
300 )
301 ) );