CTF_Modern_Elementor_Widget.php
109 lines
| 1 | <?php |
| 2 | |
| 3 | namespace TwitterFeed\Integrations\Elementor; |
| 4 | |
| 5 | use Smashballoon\TwitterFeed\Vendor\Smashballoon\Framework\Packages\Blocks\SB_Elementor_Feed_Widget; |
| 6 | use TwitterFeed\Builder\CTF_Db; |
| 7 | |
| 8 | if (! defined('ABSPATH')) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | if (! class_exists('\Elementor\Widget_Base')) { |
| 13 | return; |
| 14 | } |
| 15 | |
| 16 | // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps -- Follows codebase CTF_ prefix convention. |
| 17 | class CTF_Modern_Elementor_Widget extends SB_Elementor_Feed_Widget |
| 18 | { |
| 19 | /** |
| 20 | * Get the widget name. |
| 21 | * |
| 22 | * @return string |
| 23 | */ |
| 24 | protected function get_widget_name() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 25 | { |
| 26 | return 'sb-twitter-feed'; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get the widget title. |
| 31 | * |
| 32 | * @return string |
| 33 | */ |
| 34 | protected function get_widget_title() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 35 | { |
| 36 | return __( 'Twitter Feed', 'custom-twitter-feeds' ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get the widget icon CSS class. |
| 41 | * |
| 42 | * @return string |
| 43 | */ |
| 44 | protected function get_widget_icon() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 45 | { |
| 46 | return 'sb-elem-icon sb-elem-twitter'; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get the shortcode tag. |
| 51 | * |
| 52 | * @return string |
| 53 | */ |
| 54 | protected function get_shortcode_tag() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 55 | { |
| 56 | return 'custom-twitter-feeds'; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Get the available feeds options for the widget. |
| 61 | * |
| 62 | * @return array |
| 63 | */ |
| 64 | protected function get_feeds_options() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 65 | { |
| 66 | return CTF_Db::elementor_feeds_query(); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Get the text domain. |
| 71 | * |
| 72 | * @return string |
| 73 | */ |
| 74 | protected function get_text_domain() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 75 | { |
| 76 | return 'custom-twitter-feeds'; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Get the script dependencies. |
| 81 | * |
| 82 | * @return array |
| 83 | */ |
| 84 | protected function get_script_deps() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 85 | { |
| 86 | return array( 'ctf_scripts', 'sb-elementor-editor' ); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Get the style dependencies. |
| 91 | * |
| 92 | * @return array |
| 93 | */ |
| 94 | protected function get_style_deps() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 95 | { |
| 96 | return array( 'ctf_styles', 'sb-elementor-editor' ); |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Get the output filter name. |
| 101 | * |
| 102 | * @return string |
| 103 | */ |
| 104 | protected function get_output_filter() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 105 | { |
| 106 | return 'ctf_output'; |
| 107 | } |
| 108 | } |
| 109 |