SBR_Modern_Elementor_Widget.php
74 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SmashBalloon\Reviews\Common\Integrations\Elementor; |
| 4 | |
| 5 | use SmashBalloon\Reviews\Vendor\Smashballoon\Framework\Packages\Blocks\SB_Elementor_Feed_Widget; |
| 6 | use SmashBalloon\Reviews\Common\Customizer\DB; |
| 7 | |
| 8 | if (! defined('ABSPATH')) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | if (! class_exists('\Elementor\Widget_Base')) { |
| 13 | return; |
| 14 | } |
| 15 | |
| 16 | class SBR_Modern_Elementor_Widget extends SB_Elementor_Feed_Widget { |
| 17 | protected function get_widget_name() |
| 18 | { |
| 19 | return 'sb-reviews-feed'; |
| 20 | } |
| 21 | |
| 22 | protected function get_widget_title() |
| 23 | { |
| 24 | return __('Reviews Feed', 'reviews-feed'); |
| 25 | } |
| 26 | |
| 27 | protected function get_widget_icon() |
| 28 | { |
| 29 | return 'sb-elem-icon sb-elem-reviews'; |
| 30 | } |
| 31 | |
| 32 | protected function get_shortcode_tag() |
| 33 | { |
| 34 | return 'reviews-feed'; |
| 35 | } |
| 36 | |
| 37 | protected function get_feeds_options() |
| 38 | { |
| 39 | // SMASH-1052: editor feed-picker only needs id + feed_name, so skip |
| 40 | // the expensive shortcode-location scans here too (consistency with |
| 41 | // the front-end loader). |
| 42 | $feeds = DB::get_feeds_list(array(), true); |
| 43 | $options = array(); |
| 44 | |
| 45 | if (is_array($feeds)) { |
| 46 | foreach ($feeds as $feed) { |
| 47 | $options[ $feed['id'] ] = $feed['feed_name']; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | return $options; |
| 52 | } |
| 53 | |
| 54 | protected function get_text_domain() |
| 55 | { |
| 56 | return 'reviews-feed'; |
| 57 | } |
| 58 | |
| 59 | protected function get_script_deps() |
| 60 | { |
| 61 | return array( 'sbr_scripts', 'sb-elementor-editor' ); |
| 62 | } |
| 63 | |
| 64 | protected function get_style_deps() |
| 65 | { |
| 66 | return array( 'sbr_styles', 'sb-elementor-editor' ); |
| 67 | } |
| 68 | |
| 69 | protected function get_output_filter() |
| 70 | { |
| 71 | return 'sbr_output'; |
| 72 | } |
| 73 | } |
| 74 |