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