screen_options = array(); parent::__construct( $builder ); } /** * @since 4.5.6 */ public function __destruct() { parent::__destruct(); unset( $this->screen_options ); } /** * Create the config array for the shortcode button */ function shortcode_insert_button() { $this->config['version'] = '1.0'; $this->config['self_closing'] = 'no'; $this->config['auto_repair'] = 'no'; $this->config['name'] = __( 'Table', 'avia_framework' ); $this->config['tab'] = __( 'Content Elements', 'avia_framework' ); $this->config['icon'] = AviaBuilder::$path['imagesURL'] . 'sc-table.png'; $this->config['order'] = 35; $this->config['target'] = 'avia-target-insert'; $this->config['shortcode'] = 'av_table'; $this->config['modal_data'] = array( 'modal_class' => 'bigscreen', 'before_save' => 'before_table_save' ); $this->config['shortcode_nested'] = array( 'av_row', 'av_cell','av_button' ); $this->config['tooltip'] = __( 'Creates a data or pricing table', 'avia_framework' ); $this->config['preview'] = false; $this->config['disabling_allowed'] = true; $this->config['id_name'] = 'id'; $this->config['id_show'] = 'yes'; $this->config['alb_desc_id'] = 'alb_description'; } function admin_assets() { $ver = AviaBuilder::VERSION; wp_register_script('avia_table_js', AviaBuilder::$path['assetsURL'] . 'js/avia-table.js', array( 'avia_modal_js' ), $ver, true ); Avia_Builder()->add_registered_admin_script( 'avia_table_js' ); } function extra_assets() { //load css wp_enqueue_style( 'avia-module-table', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/table/table.css', array( 'avia-layout' ), false ); } /** * Popup Elements * * If this function is defined in a child class the element automatically gets an edit button, that, when pressed * opens a modal window that allows to edit the element properties * * @return void */ function popup_elements() { $this->elements = array( array( 'type' => 'tab_container', 'nodescription' => true ), array( 'type' => 'tab', 'name' => __( 'Content', 'avia_framework' ), 'nodescription' => true ), array( 'type' => 'template', 'template_id' => $this->popup_key( 'content_table' ) ), array( 'type' => 'tab_close', 'nodescription' => true ), array( 'type' => 'tab', 'name' => __( 'Styling', 'avia_framework' ), 'nodescription' => true ), array( 'type' => 'template', 'template_id' => 'toggle_container', 'templates_include' => array( $this->popup_key( 'styling_table' ), $this->popup_key( 'styling_caption' ) ), 'nodescription' => true ), array( 'type' => 'tab_close', 'nodescription' => true ), array( 'type' => 'tab', 'name' => __( 'Advanced', 'avia_framework' ), 'nodescription' => true ), array( 'type' => 'toggle_container', 'nodescription' => true ), array( 'type' => 'template', 'template_id' => 'screen_options_toggle', 'templates_include' => array( $this->popup_key( 'advanced_table_responsive' ), 'screen_options_visibility' ) ), array( 'type' => 'template', 'template_id' => 'developer_options_toggle', 'args' => array( 'sc' => $this ) ), array( 'type' => 'toggle_container_close', 'nodescription' => true ), array( 'type' => 'tab_close', 'nodescription' => true ), array( 'type' => 'tab_container_close', 'nodescription' => true ) ); } /** * Create and register templates for easier maintainance * * @since 4.6.4 */ protected function register_dynamic_templates() { /** * Content Tab * =========== */ $c = array( array( 'name' => __( 'Table Builder', 'avia_framework' ), 'desc' => __( 'Start by adding columns and rows, then add content and styling to each.', 'avia_framework' ), 'id' => 'table', 'container_class' => 'avia-element-fullwidth', 'type' => 'table', 'row_style' => array( __( 'Default Row', 'avia_framework' ) => '', __( 'Heading Row', 'avia_framework' ) => 'avia-heading-row', __( 'Pricing Row', 'avia_framework' ) => 'avia-pricing-row', __( 'Button Row', 'avia_framework' ) => 'avia-button-row' ), 'column_style' => array( __('Default Column', 'avia_framework' ) => '', __('Highlight Column', 'avia_framework' ) => 'avia-highlight-col', __('Description Column', 'avia_framework' ) => 'avia-desc-col', __('Center Text Column', 'avia_framework' ) => 'avia-center-col' ) ), ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'content_table' ), $c ); /** * Styling Tab * =========== */ $c = array( array( 'name' => __( 'Table Purpose', 'avia_framework' ), 'desc' => __( 'Choose if the table should be used to display tabular data or to display pricing options. (Difference: Pricing tables are flashier and try to stand out)', 'avia_framework' ), 'id' => 'purpose', 'type' => 'select', 'std' => 'pricing', 'subtype' => array( __( 'Use the table as a Pricing Table', 'avia_framework' ) => 'pricing', __( 'Use the table to display tabular data', 'avia_framework' ) => 'tabular' ) ), array( 'name' => __( 'Table Design', 'avia_framework' ), 'desc' => __( 'Use either the default or minimal design', 'avia_framework' ), 'id' => 'pricing_table_design', 'type' => 'select', 'std' => 'avia_pricing_default', 'subtype' => array( __( 'Default', 'avia_framework') => 'avia_pricing_default', __( 'Minimal', 'avia_framework') => 'avia_pricing_minimal' ) ), array( 'name' => __( 'Empty Cells', 'avia_framework' ), 'desc' => __( 'Empty Cells are by default hidden. If you want to force equal height across all columns set them to display', 'avia_framework' ), 'id' => 'pricing_hidden_cells', 'type' => 'select', 'std' => '', 'required' => array( 'purpose', 'equals', 'pricing' ), 'subtype' => array( __( 'Hide empty Cells', 'avia_framework' ) => '', __( 'Show empty Cells', 'avia_framework' ) => 'avia_show_empty_cells' ) ), ); $template = array( array( 'type' => 'template', 'template_id' => 'toggle', 'title' => __( 'Table Styling', 'avia_framework' ), 'content' => $c ), ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_table' ), $template ); $c = array( array( 'name' => __( 'Table Caption', 'avia_framework' ), 'desc' => __( 'Add a short caption to the table so visitors know what the data is about', 'avia_framework' ), 'id' => 'caption', 'type' => 'input', 'std' => '', 'required' => array( 'purpose', 'equals', 'tabular' ) ), ); $template = array( array( 'type' => 'template', 'template_id' => 'toggle', 'title' => __( 'Caption', 'avia_framework' ), 'content' => $c ), ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_caption' ), $template ); /** * Advanced Tab * =========== */ $c = array( array( 'name' => __( 'Responsive Styling', 'avia_framework' ), 'desc' => __( 'Select which table styling should be used if the screen is too small for the table.', 'avia_framework' ), 'id' => 'responsive_styling', 'type' => 'select', 'std' => 'avia_responsive_table', 'required' => array( 'purpose', 'equals', 'tabular' ), 'subtype' => array( __( 'Adjust table to screen size', 'avia_framework' ) => 'avia_responsive_table', __( 'Make entire table scrollable', 'avia_framework' ) => 'avia_scrollable_table' ) ), ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_table_responsive' ), $c ); } /** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element( $params ) { $params = parent::editor_element( $params ); return $params; } /** * Editor Sub Element - this function defines the visual appearance of an element that is displayed within a modal window and on click opens its own modal window * Works in the same way as Editor Element * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_sub_element( $params ) { $template = $this->update_template( 'label', __( 'Element', 'avia_framework' ) . ': {{label}}' ); $params['content'] = null; $params['innerHtml'] = ''; $params['innerHtml'] .= "