theme-elements
6 years ago
accordion.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
carousel-navigation.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
gallery.php
6 years ago
gmap.php
6 years ago
heading-modern.php
6 years ago
icon.php
6 years ago
image.php
6 years ago
mailchimp.php
6 years ago
modern-button.php
6 years ago
quote.php
6 years ago
recent-comments.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-products.php
6 years ago
responsive-table.php
6 years ago
search.php
6 years ago
staff.php
6 years ago
svg.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
responsive-table.php
258 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Scheme_Typography; |
| 9 | use Elementor\Group_Control_Background; |
| 10 | |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; // Exit if accessed directly. |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Elementor 'Responsive Table' widget. |
| 18 | * |
| 19 | * Elementor widget that displays an 'Responsive Table' with lightbox. |
| 20 | * |
| 21 | * @since 1.0.0 |
| 22 | */ |
| 23 | class ResponsiveTable extends Widget_Base { |
| 24 | |
| 25 | /** |
| 26 | * Get widget name. |
| 27 | * |
| 28 | * Retrieve 'Responsive Table' widget name. |
| 29 | * |
| 30 | * @since 1.0.0 |
| 31 | * @access public |
| 32 | * |
| 33 | * @return string Widget name. |
| 34 | */ |
| 35 | public function get_name() { |
| 36 | return 'aux_responsive_table'; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get widget title. |
| 41 | * |
| 42 | * Retrieve 'Responsive Table' widget title. |
| 43 | * |
| 44 | * @since 1.0.0 |
| 45 | * @access public |
| 46 | * |
| 47 | * @return string Widget title. |
| 48 | */ |
| 49 | public function get_title() { |
| 50 | return __('Responsive Table', 'auxin-elements' ); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Get widget icon. |
| 55 | * |
| 56 | * Retrieve 'Responsive Table' widget icon. |
| 57 | * |
| 58 | * @since 1.0.0 |
| 59 | * @access public |
| 60 | * |
| 61 | * @return string Widget icon. |
| 62 | */ |
| 63 | public function get_icon() { |
| 64 | return 'eicon-table auxin-badge'; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Get widget categories. |
| 69 | * |
| 70 | * Retrieve 'Responsive Table' widget icon. |
| 71 | * |
| 72 | * @since 1.0.0 |
| 73 | * @access public |
| 74 | * |
| 75 | * @return string Widget icon. |
| 76 | */ |
| 77 | public function get_categories() { |
| 78 | return array( 'auxin-core' ); |
| 79 | } |
| 80 | |
| 81 | public function get_script_depends() { |
| 82 | return ['stacktable']; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Register 'Responsive Table' widget controls. |
| 87 | * |
| 88 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 89 | * |
| 90 | * @since 1.0.0 |
| 91 | * @access protected |
| 92 | */ |
| 93 | protected function _register_controls() { |
| 94 | |
| 95 | /*-----------------------------------------------------------------------------------*/ |
| 96 | /* Content TAB |
| 97 | /*-----------------------------------------------------------------------------------*/ |
| 98 | |
| 99 | $this->start_controls_section( |
| 100 | 'table_markup_section', |
| 101 | array( |
| 102 | 'label' => __('Table Markup', 'auxin-elements' ), |
| 103 | ) |
| 104 | ); |
| 105 | |
| 106 | $this->add_control( |
| 107 | 'table_markup', |
| 108 | array( |
| 109 | 'label' => '', |
| 110 | 'type' => Controls_Manager::CODE, |
| 111 | 'show_label' => false, |
| 112 | ) |
| 113 | ); |
| 114 | |
| 115 | $this->end_controls_section(); |
| 116 | |
| 117 | |
| 118 | /*-----------------------------------------------------------------------------------*/ |
| 119 | /* Style TAB |
| 120 | /*-----------------------------------------------------------------------------------*/ |
| 121 | |
| 122 | $this->start_controls_section( |
| 123 | 'table_head_section', |
| 124 | array( |
| 125 | 'label' => __( 'Table Heading', 'auxin-elements' ), |
| 126 | 'tab' => Controls_Manager::TAB_STYLE |
| 127 | ) |
| 128 | ); |
| 129 | |
| 130 | $this->add_group_control( |
| 131 | Group_Control_Background::get_type(), |
| 132 | array( |
| 133 | 'name' => 'table_head_background_normal', |
| 134 | 'selector' => '{{WRAPPER}} th', |
| 135 | 'separator' => 'none' |
| 136 | ) |
| 137 | ); |
| 138 | |
| 139 | $this->add_group_control( |
| 140 | Group_Control_Typography::get_type(), |
| 141 | array( |
| 142 | 'name' => 'table_head_typography', |
| 143 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 144 | 'selector' => '{{WRAPPER}} th' |
| 145 | ) |
| 146 | ); |
| 147 | |
| 148 | $this->end_controls_section(); |
| 149 | |
| 150 | $this->start_controls_section( |
| 151 | 'table_body_section', |
| 152 | array( |
| 153 | 'label' => __( 'Table Body', 'auxin-elements' ), |
| 154 | 'tab' => Controls_Manager::TAB_STYLE |
| 155 | ) |
| 156 | ); |
| 157 | |
| 158 | $this->add_group_control( |
| 159 | Group_Control_Background::get_type(), |
| 160 | array( |
| 161 | 'name' => 'table_body_background_normal', |
| 162 | 'selector' => '{{WRAPPER}} td', |
| 163 | 'separator' => 'none' |
| 164 | ) |
| 165 | ); |
| 166 | |
| 167 | $this->add_group_control( |
| 168 | Group_Control_Typography::get_type(), |
| 169 | array( |
| 170 | 'name' => 'table_body_typography', |
| 171 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 172 | 'selector' => '{{WRAPPER}} td' |
| 173 | ) |
| 174 | ); |
| 175 | |
| 176 | $this->end_controls_section(); |
| 177 | |
| 178 | $this->start_controls_section( |
| 179 | 'table_odd_row_section', |
| 180 | array( |
| 181 | 'label' => __( 'Table Odd Rows', 'auxin-elements' ), |
| 182 | 'tab' => Controls_Manager::TAB_STYLE |
| 183 | ) |
| 184 | ); |
| 185 | |
| 186 | $this->add_group_control( |
| 187 | Group_Control_Background::get_type(), |
| 188 | array( |
| 189 | 'name' => 'table_odd_background_normal', |
| 190 | 'selector' => '{{WRAPPER}} tr:nth-child(2n+1)', |
| 191 | 'separator' => 'none' |
| 192 | ) |
| 193 | ); |
| 194 | |
| 195 | $this->end_controls_section(); |
| 196 | |
| 197 | $this->start_controls_section( |
| 198 | 'table_even_row_section', |
| 199 | array( |
| 200 | 'label' => __( 'Table Even Rows', 'auxin-elements' ), |
| 201 | 'tab' => Controls_Manager::TAB_STYLE |
| 202 | ) |
| 203 | ); |
| 204 | |
| 205 | $this->add_group_control( |
| 206 | Group_Control_Background::get_type(), |
| 207 | array( |
| 208 | 'name' => 'table_even_row_background_normal', |
| 209 | 'selector' => '{{WRAPPER}} tr:nth-child(2n)', |
| 210 | 'separator' => 'none' |
| 211 | ) |
| 212 | ); |
| 213 | |
| 214 | $this->end_controls_section(); |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * Render 'Tabs' widget output on the frontend. |
| 219 | * |
| 220 | * Written in PHP and used to generate the final HTML. |
| 221 | * |
| 222 | * @since 1.0.0 |
| 223 | * @access protected |
| 224 | */ |
| 225 | protected function render() { |
| 226 | |
| 227 | $settings = $this->get_settings_for_display(); |
| 228 | |
| 229 | $this->add_render_attribute( 'wrapper', 'class', 'widget-container aux-widget-responsive-table' ); |
| 230 | $this->add_render_attribute( 'inner', 'class', 'widget-inner' ); |
| 231 | |
| 232 | ?> |
| 233 | <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?> > |
| 234 | <div <?php echo $this->get_render_attribute_string( 'inner' ); ?> > |
| 235 | <?php echo $settings['table_markup']; ?> |
| 236 | </div> |
| 237 | </div> |
| 238 | <?php |
| 239 | } |
| 240 | |
| 241 | |
| 242 | /** |
| 243 | * Render responsive table element in the editor. |
| 244 | * |
| 245 | * @access protected |
| 246 | */ |
| 247 | protected function _content_template() { |
| 248 | ?> |
| 249 | <div class="widget-container widget-responsive-table"> |
| 250 | <div class="widget-inner"> |
| 251 | {{{ settings.table_markup }}} |
| 252 | </div> |
| 253 | </div> |
| 254 | <?php |
| 255 | } |
| 256 | |
| 257 | } |
| 258 |