← All changes
|
includes/elementor-widgets/property-features.php
+116
-17
1.4.60
→
2.3.1
View file →
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | return __( 'Features', 'propertyhive' ); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function get_icon() { |
| 18 | - return 'fa fa-list'; | |
| 18 | + return 'eicon-bullet-list'; | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function get_categories() { |
| 22 | 22 | return [ 'property-hive' ]; |
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | public function get_keywords() { |
| 26 | 26 | return [ 'property hive', 'propertyhive', 'property', 'features', 'key', 'bullet' ]; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - protected function _register_controls() { | |
| 29 | + protected function register_controls() { | |
| 30 | 30 | |
| 31 | 31 | $this->start_controls_section( |
| 32 | 32 | 'style_section', |
| 33 | 33 | [ |
| @@ -52,9 +52,11 @@ | ||
| 52 | 52 | \Elementor\Group_Control_Typography::get_type(), |
| 53 | 53 | [ |
| 54 | 54 | 'name' => 'title_typography', |
| 55 | 55 | 'label' => __( 'Title Typography', 'propertyhive' ), |
| 56 | - 'scheme' => \Elementor\Scheme_Typography::TYPOGRAPHY_1, | |
| 56 | + 'global' => [ | |
| 57 | + 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_PRIMARY, | |
| 58 | + ], | |
| 57 | 59 | 'selector' => '{{WRAPPER}} .features h4', |
| 58 | 60 | 'condition' => [ |
| 59 | 61 | 'show_title' => 'yes' |
| 60 | 62 | ], |
| @@ -65,11 +67,10 @@ | ||
| 65 | 67 | 'title_color', |
| 66 | 68 | [ |
| 67 | 69 | 'label' => __( 'Title Colour', 'propertyhive' ), |
| 68 | 70 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 69 | - 'scheme' => [ | |
| 70 | - 'type' => \Elementor\Scheme_Color::get_type(), | |
| 71 | - 'value' => \Elementor\Scheme_Color::COLOR_1, | |
| 71 | + 'global' => [ | |
| 72 | + 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_PRIMARY, | |
| 72 | 73 | ], |
| 73 | 74 | 'selectors' => [ |
| 74 | 75 | '{{WRAPPER}} .features h4' => 'color: {{VALUE}}', |
| 75 | 76 | ], |
| @@ -83,9 +84,11 @@ | ||
| 83 | 84 | \Elementor\Group_Control_Typography::get_type(), |
| 84 | 85 | [ |
| 85 | 86 | 'name' => 'features_typography', |
| 86 | 87 | 'label' => __( 'List Typography', 'propertyhive' ), |
| 87 | - 'scheme' => \Elementor\Scheme_Typography::TYPOGRAPHY_1, | |
| 88 | + 'global' => [ | |
| 89 | + 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_PRIMARY, | |
| 90 | + ], | |
| 88 | 91 | 'selector' => '{{WRAPPER}} .features li', |
| 89 | 92 | ] |
| 90 | 93 | ); |
| 91 | 94 | |
| @@ -93,11 +96,10 @@ | ||
| 93 | 96 | 'list_color', |
| 94 | 97 | [ |
| 95 | 98 | 'label' => __( 'List Colour', 'propertyhive' ), |
| 96 | 99 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 97 | - 'scheme' => [ | |
| 98 | - 'type' => \Elementor\Scheme_Color::get_type(), | |
| 99 | - 'value' => \Elementor\Scheme_Color::COLOR_1, | |
| 100 | + 'global' => [ | |
| 101 | + 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_PRIMARY, | |
| 100 | 102 | ], |
| 101 | 103 | 'selectors' => [ |
| 102 | 104 | '{{WRAPPER}} .features li' => 'color: {{VALUE}}', |
| 103 | 105 | ], |
| @@ -103,20 +105,65 @@ | ||
| 103 | 105 | ], |
| 104 | 106 | ] |
| 105 | 107 | ); |
| 106 | 108 | |
| 107 | - /*$this->add_control( | |
| 108 | - 'icon', | |
| 109 | + $this->add_control( | |
| 110 | + 'bullet_type', | |
| 109 | 111 | [ |
| 110 | - 'label' => __( 'List Icon', 'propertyhive' ), | |
| 112 | + 'label' => __( 'Bullet Type', 'propertyhive' ), | |
| 113 | + 'type' => \Elementor\Controls_Manager::SELECT, | |
| 114 | + 'default' => 'disc', | |
| 115 | + 'options' => [ | |
| 116 | + 'disc' => __( 'Circle', 'propertyhive' ), | |
| 117 | + 'square' => __( 'Square', 'propertyhive' ), | |
| 118 | + 'icon' => __( 'Icon', 'propertyhive' ), | |
| 119 | + ], | |
| 120 | + 'selectors' => [ | |
| 121 | + '{{WRAPPER}} .features ul' => 'list-style-type: {{VALUE}};', | |
| 122 | + ], | |
| 123 | + ] | |
| 124 | + ); | |
| 125 | + | |
| 126 | + $this->add_control( | |
| 127 | + 'bullet_icon', | |
| 128 | + [ | |
| 129 | + 'label' => __( 'Icon', 'propertyhive' ), | |
| 111 | 130 | 'type' => \Elementor\Controls_Manager::ICONS, |
| 112 | - 'default' => [ | |
| 113 | - 'value' => 'fas fa-check', | |
| 114 | - 'library' => 'solid', | |
| 131 | + 'fa4compatibility' => 'bullet_icon_old', | |
| 132 | + 'condition' => [ | |
| 133 | + 'bullet_type' => 'icon', | |
| 115 | 134 | ], |
| 116 | 135 | ] |
| 117 | - );*/ | |
| 136 | + ); | |
| 118 | 137 | |
| 138 | + $this->add_control( | |
| 139 | + 'bullet_color', | |
| 140 | + [ | |
| 141 | + 'label' => __( 'Bullet Colour', 'propertyhive' ), | |
| 142 | + 'type' => \Elementor\Controls_Manager::COLOR, | |
| 143 | + 'selectors' => [ | |
| 144 | + '{{WRAPPER}} .features ul li::marker' => 'color: {{VALUE}};', | |
| 145 | + '{{WRAPPER}} .features .ph-feature-icon' => 'color: {{VALUE}};', | |
| 146 | + '{{WRAPPER}} .features .ph-feature-icon svg' => 'fill: {{VALUE}};', | |
| 147 | + ], | |
| 148 | + ] | |
| 149 | + ); | |
| 150 | + | |
| 151 | + $this->add_responsive_control( | |
| 152 | + 'columns', | |
| 153 | + [ | |
| 154 | + 'label' => __( 'Columns', 'propertyhive' ), | |
| 155 | + 'type' => \Elementor\Controls_Manager::NUMBER, | |
| 156 | + 'min' => 1, | |
| 157 | + 'max' => 3, | |
| 158 | + 'step' => 1, | |
| 159 | + 'default' => 1, | |
| 160 | + 'selectors' => [ | |
| 161 | + '{{WRAPPER}} .features ul' => 'column-count: {{VALUE}};', | |
| 162 | + ], | |
| 163 | + ] | |
| 164 | + ); | |
| 165 | + | |
| 119 | 166 | $this->end_controls_section(); |
| 120 | 167 | |
| 121 | 168 | } |
| 122 | 169 | |
| @@ -138,8 +185,60 @@ | ||
| 138 | 185 | </style> |
| 139 | 186 | <?php |
| 140 | 187 | } |
| 141 | 188 | |
| 189 | + $bullet_type = isset( $settings['bullet_type'] ) ? $settings['bullet_type'] : 'disc'; | |
| 190 | + | |
| 191 | + ob_start(); | |
| 142 | 192 | propertyhive_template_single_features(); |
| 193 | + $output = ob_get_clean(); | |
| 194 | + | |
| 195 | + if ( $bullet_type === 'icon' && ! empty( $settings['bullet_icon']['value'] ) ) { | |
| 196 | + | |
| 197 | + $icon_html = '<span class="ph-feature-icon" aria-hidden="true">'; | |
| 198 | + ob_start(); | |
| 199 | + \Elementor\Icons_Manager::render_icon( | |
| 200 | + $settings['bullet_icon'], | |
| 201 | + [ | |
| 202 | + 'aria-hidden' => 'true', | |
| 203 | + ] | |
| 204 | + ); | |
| 205 | + $icon_html .= ob_get_clean(); | |
| 206 | + $icon_html .= '</span>'; | |
| 207 | + | |
| 208 | + $output = preg_replace( | |
| 209 | + '/<li([^>]*)>/i', | |
| 210 | + '<li$1>' . $icon_html, | |
| 211 | + $output | |
| 212 | + ); | |
| 213 | + | |
| 214 | + ?> | |
| 215 | + <style type="text/css"> | |
| 216 | + .elementor-widget-property-features .features ul { | |
| 217 | + list-style: none !important; | |
| 218 | + padding-left: 0; | |
| 219 | + } | |
| 220 | + .elementor-widget-property-features .features ul li { | |
| 221 | + display: flex; | |
| 222 | + align-items: flex-start; | |
| 223 | + gap: 8px; | |
| 224 | + } | |
| 225 | + .elementor-widget-property-features .features .ph-feature-icon { | |
| 226 | + display: inline-flex; | |
| 227 | + flex: 0 0 auto; | |
| 228 | + line-height: 1; | |
| 229 | + margin-top: 0.15em; | |
| 230 | + } | |
| 231 | + .elementor-widget-property-features .features .ph-feature-icon i, | |
| 232 | + .elementor-widget-property-features .features .ph-feature-icon svg { | |
| 233 | + width: 1em; | |
| 234 | + height: 1em; | |
| 235 | + } | |
| 236 | + </style> | |
| 237 | + <?php | |
| 238 | + } | |
| 239 | + | |
| 240 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Feature text is escaped during assembly; selected icons are generated by Elementor Icons_Manager. | |
| 241 | + echo $output; | |
| 143 | 242 | } |
| 144 | 243 | |
| 145 | 244 | } |