| @@ -31,20 +31,28 @@ | ||
| 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 | 47 | public function hide_on_search() { |
| 40 | - return true; | |
| 48 | + return Plugin::$instance->experiments->is_feature_active( 'e_hidden_wordpress_widgets' ); | |
| 41 | 49 | } |
| 42 | 50 | |
| 43 | 51 | /** |
| 44 | 52 | * Get widget name. |
| 45 | 53 | * |
| 46 | - * Retrieve WordPress widget name. | |
| 54 | + * Retrieve WordPress/Pojo widget name. | |
| 47 | 55 | * |
| 48 | 56 | * @since 1.0.0 |
| 49 | 57 | * @access public |
| 50 | 58 | * |
| @@ -56,9 +64,9 @@ | ||
| 56 | 64 | |
| 57 | 65 | /** |
| 58 | 66 | * Get widget title. |
| 59 | 67 | * |
| 60 | - * Retrieve WordPress widget title. | |
| 68 | + * Retrieve WordPress/Pojo widget title. | |
| 61 | 69 | * |
| 62 | 70 | * @since 1.0.0 |
| 63 | 71 | * @access public |
| 64 | 72 | * |
| @@ -70,9 +78,9 @@ | ||
| 70 | 78 | |
| 71 | 79 | /** |
| 72 | 80 | * Get widget categories. |
| 73 | 81 | * |
| 74 | - * Retrieve the list of categories the WordPress widget belongs to. | |
| 82 | + * Retrieve the list of categories the WordPress/Pojo widget belongs to. | |
| 75 | 83 | * |
| 76 | 84 | * Used to determine where to display the widget in the editor. |
| 77 | 85 | * |
| 78 | 86 | * @since 1.0.0 |
| @@ -77,25 +85,33 @@ | ||
| 77 | 85 | * |
| 78 | 86 | * @since 1.0.0 |
| 79 | 87 | * @access public |
| 80 | 88 | * |
| 81 | - * @return array Widget categories. Returns either a WordPress category. | |
| 89 | + * @return array Widget categories. Returns either a WordPress category or Pojo category. | |
| 82 | 90 | */ |
| 83 | 91 | public function get_categories() { |
| 84 | - return [ 'wordpress' ]; | |
| 92 | + if ( $this->is_pojo_widget() ) { | |
| 93 | + $category = 'pojo'; | |
| 94 | + } else { | |
| 95 | + $category = 'wordpress'; | |
| 96 | + } | |
| 97 | + return [ $category ]; | |
| 85 | 98 | } |
| 86 | 99 | |
| 87 | 100 | /** |
| 88 | 101 | * Get widget icon. |
| 89 | 102 | * |
| 90 | - * Retrieve WordPress widget icon. | |
| 103 | + * Retrieve WordPress/Pojo widget icon. | |
| 91 | 104 | * |
| 92 | 105 | * @since 1.0.0 |
| 93 | 106 | * @access public |
| 94 | 107 | * |
| 95 | - * @return string Widget icon. Returns either a WordPress icon. | |
| 108 | + * @return string Widget icon. Returns either a WordPress icon or Pojo icon. | |
| 96 | 109 | */ |
| 97 | 110 | public function get_icon() { |
| 111 | + if ( $this->is_pojo_widget() ) { | |
| 112 | + return 'eicon-pojome'; | |
| 113 | + } | |
| 98 | 114 | return 'eicon-wordpress'; |
| 99 | 115 | } |
| 100 | 116 | |
| 101 | 117 | /** |
| @@ -111,36 +127,8 @@ | ||
| 111 | 127 | public function get_keywords() { |
| 112 | 128 | return [ 'wordpress', 'widget' ]; |
| 113 | 129 | } |
| 114 | 130 | |
| 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 | 131 | public function get_help_url() { |
| 144 | 132 | return ''; |
| 145 | 133 | } |
| 146 | 134 | |
| @@ -158,9 +146,9 @@ | ||
| 158 | 146 | return true; |
| 159 | 147 | } |
| 160 | 148 | |
| 161 | 149 | /** |
| 162 | - * Retrieve WordPress widget form. | |
| 150 | + * Retrieve WordPress/Pojo widget form. | |
| 163 | 151 | * |
| 164 | 152 | * Returns the WordPress widget form, to be used in Elementor. |
| 165 | 153 | * |
| 166 | 154 | * @since 1.0.0 |
| @@ -183,9 +171,9 @@ | ||
| 183 | 171 | return ob_get_clean(); |
| 184 | 172 | } |
| 185 | 173 | |
| 186 | 174 | /** |
| 187 | - * Retrieve WordPress widget instance. | |
| 175 | + * Retrieve WordPress/Pojo widget instance. | |
| 188 | 176 | * |
| 189 | 177 | * Returns an instance of WordPress widget, to be used in Elementor. |
| 190 | 178 | * |
| 191 | 179 | * @since 1.0.0 |
| @@ -208,9 +196,9 @@ | ||
| 208 | 196 | return $this->_widget_instance; |
| 209 | 197 | } |
| 210 | 198 | |
| 211 | 199 | /** |
| 212 | - * Retrieve WordPress widget parsed settings. | |
| 200 | + * Retrieve WordPress/Pojo widget parsed settings. | |
| 213 | 201 | * |
| 214 | 202 | * Returns the WordPress widget settings, to be used in Elementor. |
| 215 | 203 | * |
| 216 | 204 | * @access protected |
| @@ -231,9 +219,9 @@ | ||
| 231 | 219 | return $settings; |
| 232 | 220 | } |
| 233 | 221 | |
| 234 | 222 | /** |
| 235 | - * Register WordPress widget controls. | |
| 223 | + * Register WordPress/Pojo widget controls. | |
| 236 | 224 | * |
| 237 | 225 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 238 | 226 | * |
| 239 | 227 | * @since 3.1.0 |
| @@ -251,9 +239,9 @@ | ||
| 251 | 239 | ); |
| 252 | 240 | } |
| 253 | 241 | |
| 254 | 242 | /** |
| 255 | - * Render WordPress widget output on the frontend. | |
| 243 | + * Render WordPress/Pojo widget output on the frontend. | |
| 256 | 244 | * |
| 257 | 245 | * Written in PHP and used to generate the final HTML. |
| 258 | 246 | * |
| 259 | 247 | * @since 1.0.0 |
| @@ -292,9 +280,9 @@ | ||
| 292 | 280 | } |
| 293 | 281 | } |
| 294 | 282 | |
| 295 | 283 | /** |
| 296 | - * Render WordPress widget output in the editor. | |
| 284 | + * Render WordPress/Pojo widget output in the editor. | |
| 297 | 285 | * |
| 298 | 286 | * Written as a Backbone JavaScript template and used to generate the live preview. |
| 299 | 287 | * |
| 300 | 288 | * @since 2.9.0 |
| @@ -302,9 +290,9 @@ | ||
| 302 | 290 | */ |
| 303 | 291 | protected function content_template() {} |
| 304 | 292 | |
| 305 | 293 | /** |
| 306 | - * WordPress widget constructor. | |
| 294 | + * WordPress/Pojo widget constructor. | |
| 307 | 295 | * |
| 308 | 296 | * Used to run WordPress widget constructor. |
| 309 | 297 | * |
| 310 | 298 | * @since 1.0.0 |
| @@ -319,9 +307,9 @@ | ||
| 319 | 307 | parent::__construct( $data, $args ); |
| 320 | 308 | } |
| 321 | 309 | |
| 322 | 310 | /** |
| 323 | - * Render WordPress widget as plain content. | |
| 311 | + * Render WordPress/Pojo widget as plain content. | |
| 324 | 312 | * |
| 325 | 313 | * Override the default render behavior, don't render widget content. |
| 326 | 314 | * |
| 327 | 315 | * @since 1.0.0 |