about-widget.php
1 year ago
accordion-widget.php
1 year ago
accordion.php
1 year ago
attachment-url.php
1 year ago
audio.php
1 year ago
before-after.php
1 year ago
button.php
1 year ago
code.php
1 year ago
contact-box.php
1 year ago
contact-form.php
1 year ago
custom-list.php
6 months ago
divider.php
1 year ago
dropcap.php
1 year ago
facebook.php
1 year ago
flickr.php
1 year ago
gallery.php
1 year ago
gmap.php
1 year ago
highlight.php
1 year ago
image.php
1 year ago
instagram-feed.php
1 year ago
latest-posts-slider.php
1 year ago
popular-posts-widget.php
1 year ago
products-grid.php
1 year ago
quote.php
1 year ago
recent-posts-grid-carousel.php
1 year ago
recent-posts-land-style.php
1 year ago
recent-posts-masonry.php
1 year ago
recent-posts-tiles-carousel.php
1 year ago
recent-posts-tiles.php
1 year ago
recent-posts-timeline.php
1 year ago
recent-posts-widget.php
1 year ago
recent-products.php
1 year ago
related-posts.php
8 years ago
sample-element.php
1 year ago
search.php
1 year ago
socials-list.php
1 year ago
staff.php
1 year ago
tab-widget.php
1 year ago
tabs.php
1 year ago
testimonial.php
1 year ago
text.php
1 year ago
touch-slider.php
1 year ago
video.php
1 year ago
custom-list.php
332 lines
| 1 | <?php |
| 2 | /** |
| 3 | * List element if site origin bundle plugin is activaited |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author averta |
| 9 | * @link http://phlox.pro/ |
| 10 | * @copyright (c) 2010-2025 averta |
| 11 | */ |
| 12 | |
| 13 | function auxin_get_list_master_array( $master_array ) { |
| 14 | |
| 15 | $master_array['aux_icon_list'] = array( |
| 16 | 'name' => __('List', 'auxin-elements'), |
| 17 | 'auxin_output_callback' => 'auxin_widget_list_callback', |
| 18 | 'base' => 'aux_icon_list', |
| 19 | 'description' => __('Icon List', 'auxin-elements'), |
| 20 | 'class' => 'aux-widget-icon-list', |
| 21 | 'show_settings_on_create' => true, |
| 22 | 'weight' => 1, |
| 23 | 'is_widget' => false, |
| 24 | 'is_shortcode' => true, |
| 25 | 'category' => THEME_NAME, |
| 26 | 'group' => '', |
| 27 | 'admin_enqueue_js' => '', |
| 28 | 'admin_enqueue_css' => '', |
| 29 | 'front_enqueue_js' => '', |
| 30 | 'front_enqueue_css' => '', |
| 31 | 'icon' => 'aux-element aux-pb-icons-list', |
| 32 | 'custom_markup' => '', |
| 33 | 'js_view' => '', |
| 34 | 'html_template' => '', |
| 35 | 'deprecated' => '', |
| 36 | 'content_element' => '', |
| 37 | 'as_parent' => '', |
| 38 | 'as_child' => '', |
| 39 | 'params' => array( |
| 40 | array( |
| 41 | 'heading' => __('Title','auxin-elements'), |
| 42 | 'description' => __('leave it empty if you don`t need title.', 'auxin-elements'), |
| 43 | 'param_name' => 'title', |
| 44 | 'type' => 'textfield', |
| 45 | 'value' => '', |
| 46 | 'holder' => 'textfield', |
| 47 | 'class' => 'title', |
| 48 | 'admin_label' => false, |
| 49 | 'dependency' => '', |
| 50 | 'weight' => '', |
| 51 | 'group' => '' , |
| 52 | 'edit_field_class' => '' |
| 53 | ), |
| 54 | array( |
| 55 | 'heading' => __('Text','auxin-elements'), |
| 56 | 'repeater' => 'list', |
| 57 | 'repeater-label' => __('List', 'auxin-elements'), |
| 58 | 'section-name' => __('List Item', 'auxin-elements'), |
| 59 | 'param_name' => 'text_primary', |
| 60 | 'type' => 'textfield', |
| 61 | 'value' => __('List Item', 'auxin-elements' ), |
| 62 | 'holder' => 'textfield', |
| 63 | 'class' => 'text_primary', |
| 64 | 'admin_label' => true, |
| 65 | 'dependency' => '', |
| 66 | 'weight' => '', |
| 67 | 'group' => '' , |
| 68 | 'edit_field_class' => '' |
| 69 | ), |
| 70 | array( |
| 71 | 'heading' => __('Icon','auxin-elements'), |
| 72 | 'repeater' => 'list', |
| 73 | 'repeater-label' => __('List', 'auxin-elements'), |
| 74 | 'section-name' => __('List Item', 'auxin-elements'), |
| 75 | 'param_name' => 'icon', |
| 76 | 'type' => 'aux_iconpicker', |
| 77 | 'value' => '', |
| 78 | 'holder' => 'textfield', |
| 79 | 'class' => 'item_icon', |
| 80 | 'admin_label' => false, |
| 81 | 'dependency' => '', |
| 82 | 'weight' => '', |
| 83 | 'group' => '' , |
| 84 | 'edit_field_class' => '' |
| 85 | ), |
| 86 | array( |
| 87 | 'heading' => __('Text Tag','auxin-elements'), |
| 88 | 'repeater' => 'list', |
| 89 | 'repeater-label' => __('List', 'auxin-elements'), |
| 90 | 'section-name' => __('List Item', 'auxin-elements'), |
| 91 | 'param_name' => 'text_tag', |
| 92 | 'type' => 'textfield', |
| 93 | 'value' => __('List Item', 'auxin-elements' ), |
| 94 | 'holder' => 'textfield', |
| 95 | 'class' => 'text_tag', |
| 96 | 'admin_label' => true, |
| 97 | 'dependency' => '', |
| 98 | 'weight' => '', |
| 99 | 'group' => '' , |
| 100 | 'edit_field_class' => '' |
| 101 | ), |
| 102 | array( |
| 103 | 'heading' => __('Link','auxin-elements'), |
| 104 | 'repeater' => 'list', |
| 105 | 'repeater-label' => __('List', 'auxin-elements'), |
| 106 | 'section-name' => __('List Item', 'auxin-elements'), |
| 107 | 'param_name' => 'link', |
| 108 | 'type' => 'textfield', |
| 109 | 'value' => '', |
| 110 | 'holder' => 'textfield', |
| 111 | 'class' => 'link', |
| 112 | 'admin_label' => false, |
| 113 | 'dependency' => '', |
| 114 | 'weight' => '', |
| 115 | 'group' => '' , |
| 116 | 'edit_field_class' => '' |
| 117 | ), |
| 118 | array( |
| 119 | 'heading' => __('Text Seconday','auxin-elements'), |
| 120 | 'repeater' => 'list', |
| 121 | 'repeater-label' => __('List', 'auxin-elements'), |
| 122 | 'section-name' => __('List Item', 'auxin-elements'), |
| 123 | 'param_name' => 'text_secondary', |
| 124 | 'type' => 'textfield', |
| 125 | 'value' => '', |
| 126 | 'holder' => 'textfield', |
| 127 | 'class' => 'text_secondary', |
| 128 | 'admin_label' => true, |
| 129 | 'dependency' => '', |
| 130 | 'weight' => '', |
| 131 | 'group' => '' , |
| 132 | 'edit_field_class' => '' |
| 133 | ), |
| 134 | array( |
| 135 | 'heading' => __('Description','auxin-elements'), |
| 136 | 'repeater' => 'list', |
| 137 | 'repeater-label' => __('List', 'auxin-elements'), |
| 138 | 'section-name' => __('List Item', 'auxin-elements'), |
| 139 | 'param_name' => 'description', |
| 140 | 'type' => 'textfield', |
| 141 | 'value' => '', |
| 142 | 'holder' => 'textfield', |
| 143 | 'class' => 'description', |
| 144 | 'admin_label' => true, |
| 145 | 'dependency' => '', |
| 146 | 'weight' => '', |
| 147 | 'group' => '' , |
| 148 | 'edit_field_class' => '' |
| 149 | ), |
| 150 | array( |
| 151 | 'heading' => __('Display Connector','auxin-elements' ), |
| 152 | 'description' => __('Whether to display a line that connects two texts in each list item.', 'auxin-elements'), |
| 153 | 'param_name' => 'connector', |
| 154 | 'type' => 'dropdown', |
| 155 | 'def_value' => 'no', |
| 156 | 'value' => array( |
| 157 | 'yes' => __('Yes', 'auxin-elements' ), |
| 158 | 'no' => __('No' , 'auxin-elements' ) |
| 159 | ), |
| 160 | 'holder' => '', |
| 161 | 'class' => '', |
| 162 | 'admin_label' => false, |
| 163 | 'dependency' => '', |
| 164 | 'weight' => '', |
| 165 | 'group' => '' , |
| 166 | 'edit_field_class' => '' |
| 167 | ), |
| 168 | array( |
| 169 | 'heading' => __('Display Divider','auxin-elements' ), |
| 170 | 'description' => __('Whether to display a divider between list items or not.', 'auxin-elements'), |
| 171 | 'param_name' => 'divider', |
| 172 | 'type' => 'dropdown', |
| 173 | 'def_value' => 'no', |
| 174 | 'value' => array( |
| 175 | 'yes' => __('Yes', 'auxin-elements' ), |
| 176 | 'no' => __('No' , 'auxin-elements' ) |
| 177 | ), |
| 178 | 'holder' => '', |
| 179 | 'class' => '', |
| 180 | 'admin_label' => false, |
| 181 | 'dependency' => '', |
| 182 | 'weight' => '', |
| 183 | 'group' => '' , |
| 184 | 'edit_field_class' => '' |
| 185 | ), |
| 186 | array( |
| 187 | 'heading' => __('Extra class name','auxin-elements'), |
| 188 | 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements'), |
| 189 | 'param_name' => 'extra_classes', |
| 190 | 'type' => 'textfield', |
| 191 | 'value' => '', |
| 192 | 'def_value' => '', |
| 193 | 'holder' => 'textfield', |
| 194 | 'class' => 'extra_classes', |
| 195 | 'admin_label' => false, |
| 196 | 'dependency' => '', |
| 197 | 'weight' => '', |
| 198 | 'group' => '' , |
| 199 | 'edit_field_class' => '' |
| 200 | ) |
| 201 | ) |
| 202 | ); |
| 203 | |
| 204 | return $master_array; |
| 205 | } |
| 206 | |
| 207 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_list_master_array', 10, 1 ); |
| 208 | |
| 209 | |
| 210 | /** |
| 211 | * List Element |
| 212 | * |
| 213 | * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above. |
| 214 | * @param string $shortcode_content The shorcode content |
| 215 | * @return string The output of element markup |
| 216 | */ |
| 217 | function auxin_widget_list_callback( $atts, $shortcode_content = null ){ |
| 218 | |
| 219 | // Defining default attributes |
| 220 | $default_atts = array( |
| 221 | 'title' => '', // header title |
| 222 | 'list' => '', // repeater items |
| 223 | 'direction' => 'default', |
| 224 | 'connector' => 'no', |
| 225 | 'divider' => 'no', |
| 226 | 'title_tag' => 'h6', |
| 227 | 'item_class_prefix' => '', // Default class prefix for each repeater item |
| 228 | 'extra_classes' => '', // custom css class names for this element |
| 229 | 'custom_el_id' => '', // custom id attribute for this element |
| 230 | 'base_class' => 'aux-widget-icon-list' // base class name for container |
| 231 | ); |
| 232 | |
| 233 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 234 | extract( $result['parsed_atts'] ); |
| 235 | |
| 236 | // widget header ------------------------------ |
| 237 | $output = $result['widget_header']; |
| 238 | $output .= $result['widget_title']; |
| 239 | |
| 240 | $output .= '<div class="widget-inner">'; |
| 241 | $output .= '<div class="aux-widget-icon-list-inner">'; |
| 242 | |
| 243 | // Attrs for list wrapper |
| 244 | $list_attrs = array( |
| 245 | 'class' => array( 'aux-icon-list-items', 'aux-direction-' . esc_attr( $direction ) ) |
| 246 | ); |
| 247 | if( auxin_is_true( $divider ) ){ |
| 248 | $list_attrs['class'][] = 'aux-icon-list-divider'; |
| 249 | } |
| 250 | $output .= '<ul '. auxin_make_html_attributes( $list_attrs ) .'>'; |
| 251 | |
| 252 | |
| 253 | // widget custom output ----------------------- |
| 254 | if ( is_array( $list ) || is_object( $list ) ) { |
| 255 | foreach ( $list as $index => $list_item ) { |
| 256 | |
| 257 | // Class for each repeater item |
| 258 | $item_classes = array( 'aux-icon-list-item' ); |
| 259 | |
| 260 | if( auxin_is_true( $connector ) ){ |
| 261 | $item_classes[] = 'aux-list-item-has-connector'; |
| 262 | } |
| 263 | |
| 264 | if( ! empty( $list_item['custom_class_name'] ) ) { |
| 265 | $item_classes[] = $list_item['custom_class_name']; |
| 266 | } |
| 267 | |
| 268 | if( $item_unique_id = ! empty( $list_item['_id'] ) ? $list_item['_id'] : '' ){ |
| 269 | $item_classes[] = 'aux-list-item-has-icon'; |
| 270 | $item_classes[] = 'aux-icon-list-item-'. esc_attr( $item_unique_id ); |
| 271 | $item_classes[] = 'elementor-repeater-item-'. esc_attr( $item_unique_id ); |
| 272 | } |
| 273 | |
| 274 | $item_text_tag = ! empty( $list_item['text_tag'] ) && $list_item['text_tag'] != 'script' ? $list_item['text_tag'] : 'span'; |
| 275 | $output .= '<li '. auxin_make_html_attributes( array( 'class' => $item_classes ) ) .'>'; |
| 276 | |
| 277 | // Generate link for list item |
| 278 | if( ! empty( $list_item['link']['url'] ) ){ |
| 279 | $link_attrs = array( |
| 280 | 'class' => array( 'aux-icon-list-link' ), |
| 281 | 'href' => esc_url( $list_item['link']['url'] ) |
| 282 | ); |
| 283 | if( ! empty( $list_item['link']['is_external'] ) ){ |
| 284 | $link_attrs['target'] = '_blank'; |
| 285 | } |
| 286 | if( ! empty( $list_item['link']['nofollow'] ) ){ |
| 287 | $link_attrs['rel'] = 'nofollow'; |
| 288 | } |
| 289 | $output .= '<a '. auxin_make_html_attributes( $link_attrs ) .'>'; |
| 290 | } |
| 291 | |
| 292 | // a fix to prevent unwanted default value 'check-1' which is set in elementor |
| 293 | if( ( ! empty( $list_item['icon'] ) && 'check-1' != $list_item['icon'] ) || is_array( $list_item['icon'] ) ){ |
| 294 | if ( is_array( $list_item['icon'] ) ) { |
| 295 | if ( $list_item['icon']['library'] == 'svg') { |
| 296 | $output .= '<div class="aux-icon-list-icon">' . \Elementor\Icons_Manager::render_uploaded_svg_icon( $list_item['icon']['value']) . '</div>'; |
| 297 | } else { |
| 298 | $output .= \Elementor\Icons_Manager::render_font_icon( $list_item['icon'], [ 'aria-hidden' => 'true', 'class' => 'aux-icon-list-icon' ] ); |
| 299 | } |
| 300 | } else { |
| 301 | $output .= '<span '. auxin_make_html_attributes( array( 'class' => array( 'aux-icon-list-icon', esc_attr( $list_item['icon'] ) ) ) ) .'></span>'; |
| 302 | } |
| 303 | } |
| 304 | if( ! empty( $list_item['text_primary'] ) ){ |
| 305 | $output .= "<$item_text_tag ". auxin_make_html_attributes( array( 'class' => array( 'aux-icon-list-text' ) ) ) .'>' . auxin_kses( $list_item['text_primary'] ) . "</$item_text_tag>"; |
| 306 | } |
| 307 | if( auxin_is_true( $connector ) ){ |
| 308 | $output .= '<span '. auxin_make_html_attributes( array( 'class' => array( 'aux-list-connector' ) ) ) .'></span>'; |
| 309 | } |
| 310 | if( ! empty( $list_item['text_secondary'] ) ){ |
| 311 | $output .= '<span '. auxin_make_html_attributes( array( 'class' => array( 'aux-icon-list-text2' ) ) ) .'>' . auxin_kses( $list_item['text_secondary'] ) . '</span>'; |
| 312 | } |
| 313 | if( ! empty( $list_item['description'] ) ){ |
| 314 | $output .= '<p '. auxin_make_html_attributes( array( 'class' => array( 'aux-icon-list-description' ) ) ) .'>' . auxin_kses( $list_item['description'] ) . '</p>'; |
| 315 | } |
| 316 | |
| 317 | if( ! empty( $list_item['link']['url'] ) ){ |
| 318 | $output .= '</a>'; |
| 319 | } |
| 320 | |
| 321 | $output .= '</li>'; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | $output .= '</ul></div></div>'; // End od widget-toggle |
| 326 | $output .= $result['widget_footer']; |
| 327 | |
| 328 | // widget footer ------------------------------ |
| 329 | |
| 330 | return wp_kses_post( $output ); |
| 331 | } |
| 332 |