PluginProbe
Borderless – Addons and Templates for Elementor / trunk
Borderless – Addons and Templates for Elementor vtrunk
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 trunk, at modules/wpbakery/elements/list-group.php

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