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