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