| @@ -31,16 +31,24 @@ | ||
| 31 | 31 | * @var \WP_Widget |
| 32 | 32 | */ |
| 33 | 33 | private $_widget_instance = null; |
| 34 | 34 | |
| 35 | - public function hide_on_search() { | |
| 36 | - return true; | |
| 35 | + /** | |
| 36 | + * Whether the widget is a Pojo widget or not. | |
| 37 | + * | |
| 38 | + * @since 2.0.0 | |
| 39 | + * @access private | |
| 40 | + * | |
| 41 | + * @return bool | |
| 42 | + */ | |
| 43 | + private function is_pojo_widget() { | |
| 44 | + return $this->get_widget_instance() instanceof \Pojo_Widget_Base; | |
| 37 | 45 | } |
| 38 | 46 | |
| 39 | 47 | /** |
| 40 | 48 | * Get widget name. |
| 41 | 49 | * |
| 42 | - * Retrieve WordPress widget name. | |
| 50 | + * Retrieve WordPress/Pojo widget name. | |
| 43 | 51 | * |
| 44 | 52 | * @since 1.0.0 |
| 45 | 53 | * @access public |
| 46 | 54 | * |
| @@ -52,9 +60,9 @@ | ||
| 52 | 60 | |
| 53 | 61 | /** |
| 54 | 62 | * Get widget title. |
| 55 | 63 | * |
| 56 | - * Retrieve WordPress widget title. | |
| 64 | + * Retrieve WordPress/Pojo widget title. | |
| 57 | 65 | * |
| 58 | 66 | * @since 1.0.0 |
| 59 | 67 | * @access public |
| 60 | 68 | * |
| @@ -66,9 +74,9 @@ | ||
| 66 | 74 | |
| 67 | 75 | /** |
| 68 | 76 | * Get widget categories. |
| 69 | 77 | * |
| 70 | - * Retrieve the list of categories the WordPress widget belongs to. | |
| 78 | + * Retrieve the list of categories the WordPress/Pojo widget belongs to. | |
| 71 | 79 | * |
| 72 | 80 | * Used to determine where to display the widget in the editor. |
| 73 | 81 | * |
| 74 | 82 | * @since 1.0.0 |
| @@ -73,25 +81,33 @@ | ||
| 73 | 81 | * |
| 74 | 82 | * @since 1.0.0 |
| 75 | 83 | * @access public |
| 76 | 84 | * |
| 77 | - * @return array Widget categories. Returns either a WordPress category. | |
| 85 | + * @return array Widget categories. Returns either a WordPress category or Pojo category. | |
| 78 | 86 | */ |
| 79 | 87 | public function get_categories() { |
| 80 | - return [ 'wordpress' ]; | |
| 88 | + if ( $this->is_pojo_widget() ) { | |
| 89 | + $category = 'pojo'; | |
| 90 | + } else { | |
| 91 | + $category = 'wordpress'; | |
| 92 | + } | |
| 93 | + return [ $category ]; | |
| 81 | 94 | } |
| 82 | 95 | |
| 83 | 96 | /** |
| 84 | 97 | * Get widget icon. |
| 85 | 98 | * |
| 86 | - * Retrieve WordPress widget icon. | |
| 99 | + * Retrieve WordPress/Pojo widget icon. | |
| 87 | 100 | * |
| 88 | 101 | * @since 1.0.0 |
| 89 | 102 | * @access public |
| 90 | 103 | * |
| 91 | - * @return string Widget icon. Returns either a WordPress icon. | |
| 104 | + * @return string Widget icon. Returns either a WordPress icon or Pojo icon. | |
| 92 | 105 | */ |
| 93 | 106 | public function get_icon() { |
| 107 | + if ( $this->is_pojo_widget() ) { | |
| 108 | + return 'eicon-pojome'; | |
| 109 | + } | |
| 94 | 110 | return 'eicon-wordpress'; |
| 95 | 111 | } |
| 96 | 112 | |
| 97 | 113 | /** |
| @@ -107,36 +123,8 @@ | ||
| 107 | 123 | public function get_keywords() { |
| 108 | 124 | return [ 'wordpress', 'widget' ]; |
| 109 | 125 | } |
| 110 | 126 | |
| 111 | - /** | |
| 112 | - * Get style dependencies. | |
| 113 | - * | |
| 114 | - * Retrieve the list of style dependencies the widget requires. | |
| 115 | - * | |
| 116 | - * @since 3.26.0 | |
| 117 | - * @access public | |
| 118 | - * | |
| 119 | - * @return array Widget style dependencies. | |
| 120 | - */ | |
| 121 | - public function get_style_depends(): array { | |
| 122 | - return [ 'e-swiper' ]; | |
| 123 | - } | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * Get script dependencies. | |
| 127 | - * | |
| 128 | - * Retrieve the list of script dependencies the widget requires. | |
| 129 | - * | |
| 130 | - * @since 3.27.0 | |
| 131 | - * @access public | |
| 132 | - * | |
| 133 | - * @return array Widget script dependencies. | |
| 134 | - */ | |
| 135 | - public function get_script_depends(): array { | |
| 136 | - return [ 'swiper' ]; | |
| 137 | - } | |
| 138 | - | |
| 139 | 127 | public function get_help_url() { |
| 140 | 128 | return ''; |
| 141 | 129 | } |
| 142 | 130 | |
| @@ -154,9 +142,9 @@ | ||
| 154 | 142 | return true; |
| 155 | 143 | } |
| 156 | 144 | |
| 157 | 145 | /** |
| 158 | - * Retrieve WordPress widget form. | |
| 146 | + * Retrieve WordPress/Pojo widget form. | |
| 159 | 147 | * |
| 160 | 148 | * Returns the WordPress widget form, to be used in Elementor. |
| 161 | 149 | * |
| 162 | 150 | * @since 1.0.0 |
| @@ -179,9 +167,9 @@ | ||
| 179 | 167 | return ob_get_clean(); |
| 180 | 168 | } |
| 181 | 169 | |
| 182 | 170 | /** |
| 183 | - * Retrieve WordPress widget instance. | |
| 171 | + * Retrieve WordPress/Pojo widget instance. | |
| 184 | 172 | * |
| 185 | 173 | * Returns an instance of WordPress widget, to be used in Elementor. |
| 186 | 174 | * |
| 187 | 175 | * @since 1.0.0 |
| @@ -204,9 +192,9 @@ | ||
| 204 | 192 | return $this->_widget_instance; |
| 205 | 193 | } |
| 206 | 194 | |
| 207 | 195 | /** |
| 208 | - * Retrieve WordPress widget parsed settings. | |
| 196 | + * Retrieve WordPress/Pojo widget parsed settings. | |
| 209 | 197 | * |
| 210 | 198 | * Returns the WordPress widget settings, to be used in Elementor. |
| 211 | 199 | * |
| 212 | 200 | * @access protected |
| @@ -219,9 +207,8 @@ | ||
| 219 | 207 | |
| 220 | 208 | if ( ! empty( $settings['wp'] ) ) { |
| 221 | 209 | $widget = $this->get_widget_instance(); |
| 222 | 210 | $instance = $widget->update( $settings['wp'], [] ); |
| 223 | - /** This filter is documented in wp-includes/class-wp-widget.php */ | |
| 224 | 211 | $settings['wp'] = apply_filters( 'widget_update_callback', $instance, $settings['wp'], [], $widget ); |
| 225 | 212 | } |
| 226 | 213 | |
| 227 | 214 | return $settings; |
| @@ -227,9 +214,9 @@ | ||
| 227 | 214 | return $settings; |
| 228 | 215 | } |
| 229 | 216 | |
| 230 | 217 | /** |
| 231 | - * Register WordPress widget controls. | |
| 218 | + * Register WordPress/Pojo widget controls. | |
| 232 | 219 | * |
| 233 | 220 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 234 | 221 | * |
| 235 | 222 | * @since 3.1.0 |
| @@ -238,9 +225,9 @@ | ||
| 238 | 225 | protected function register_controls() { |
| 239 | 226 | $this->add_control( |
| 240 | 227 | 'wp', |
| 241 | 228 | [ |
| 242 | - 'label' => esc_html__( 'Form', 'elementor' ), | |
| 229 | + 'label' => __( 'Form', 'elementor' ), | |
| 243 | 230 | 'type' => Controls_Manager::WP_WIDGET, |
| 244 | 231 | 'widget' => $this->get_name(), |
| 245 | 232 | 'id_base' => $this->get_widget_instance()->id_base, |
| 246 | 233 | ] |
| @@ -247,9 +234,9 @@ | ||
| 247 | 234 | ); |
| 248 | 235 | } |
| 249 | 236 | |
| 250 | 237 | /** |
| 251 | - * Render WordPress widget output on the frontend. | |
| 238 | + * Render WordPress/Pojo widget output on the frontend. | |
| 252 | 239 | * |
| 253 | 240 | * Written in PHP and used to generate the final HTML. |
| 254 | 241 | * |
| 255 | 242 | * @since 1.0.0 |
| @@ -288,9 +275,9 @@ | ||
| 288 | 275 | } |
| 289 | 276 | } |
| 290 | 277 | |
| 291 | 278 | /** |
| 292 | - * Render WordPress widget output in the editor. | |
| 279 | + * Render WordPress/Pojo widget output in the editor. | |
| 293 | 280 | * |
| 294 | 281 | * Written as a Backbone JavaScript template and used to generate the live preview. |
| 295 | 282 | * |
| 296 | 283 | * @since 2.9.0 |
| @@ -298,9 +285,9 @@ | ||
| 298 | 285 | */ |
| 299 | 286 | protected function content_template() {} |
| 300 | 287 | |
| 301 | 288 | /** |
| 302 | - * WordPress widget constructor. | |
| 289 | + * WordPress/Pojo widget constructor. | |
| 303 | 290 | * |
| 304 | 291 | * Used to run WordPress widget constructor. |
| 305 | 292 | * |
| 306 | 293 | * @since 1.0.0 |
| @@ -315,9 +302,9 @@ | ||
| 315 | 302 | parent::__construct( $data, $args ); |
| 316 | 303 | } |
| 317 | 304 | |
| 318 | 305 | /** |
| 319 | - * Render WordPress widget as plain content. | |
| 306 | + * Render WordPress/Pojo widget as plain content. | |
| 320 | 307 | * |
| 321 | 308 | * Override the default render behavior, don't render widget content. |
| 322 | 309 | * |
| 323 | 310 | * @since 1.0.0 |