rray( 'type' => 'tab_close', 'nodescription' => true ), array( 'type' => 'template', 'template_id' => 'element_template_selection_tab', 'args' => array( 'sc' => $this ) ), array( 'id' => 'av_element_hidden_in_editor', 'type' => 'hidden', 'std' => '0' ), array( 'type' => 'tab_container_close', 'nodescription' => true ) ); } /** * Create and register templates for easier maintainance * * @since 4.6.4 */ protected function register_dynamic_templates() { global $avia_config; $desc = __( 'Select order of cells when switched to fullwidth. Individual position must be set in "Advanced Tab -> Responsive Toggle".', 'avia_framework' ) . '

'; $desc .= '' . __( ' This is currently a beta feature (added 4.8.7)', 'avia_framework' ) . ''; /** * Advanced Tab * ============= */ $c = array( array( 'name' => __( 'Mobile Behaviour', 'avia_framework' ), 'desc' => __( 'Choose how the cells inside the grid should behave on mobile devices and small screens', 'avia_framework' ), 'id' => 'mobile', 'type' => 'select', 'std' => 'av-flex-cells', 'lockable' => true, 'subtype' => array( __( 'Default: Each cell is displayed on its own', 'avia_framework' ) => 'av-flex-cells', __( 'Cells appear beside each other, just like on large screens', 'avia_framework' ) => 'av-fixed-cells', ) ), array( 'name' => __( 'Mobile Breaking Point', 'avia_framework' ), 'desc' => __( 'Set the screen width when cells in this row should switch to full width', 'avia_framework' ), 'type' => 'heading', 'required' => array( 'mobile', 'not', 'av-fixed-cells' ), 'description_class' => 'av-builder-note av-neutral' ), array( 'name' => __( 'Fullwidth Break Point', 'avia_framework' ), 'desc' => __( 'The cells in this row will switch to fullwidth at this screen width ', 'avia_framework' ), 'id' => 'mobile_breaking', 'type' => 'select', 'std' => '', 'lockable' => true, 'required' => array( 'mobile', 'not', 'av-fixed-cells' ), 'subtype' => array( __( 'On mobile devices (at a screen width of 767px or lower)', 'avia_framework' ) => '', __( 'On tablets (at a screen width of 989px or lower)', 'avia_framework' ) => 'av-break-at-tablet', ) ), array( 'name' => __( 'Column Behaviour When Fullwidth', 'avia_framework' ), 'desc' => $desc, 'id' => 'mobile_column_order', 'type' => 'select', 'std' => '', 'lockable' => true, 'required' => array( 'mobile', 'not', 'av-fixed-cells' ), 'subtype' => array( __( 'Same order as defined for desktop', 'avia_framework' ) => '', __( 'Reverse order', 'avia_framework' ) => 'reverse', __( 'Individually select position for each column', 'avia_framework' ) => 'individual', ) ) ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_mobile' ), $c, true ); /** * Styling Tab * =========== */ $c = array( array( 'name' => __( 'Grid Borders', 'avia_framework' ), 'desc' => __( 'Choose if your layout grid should display any border', 'avia_framework' ), 'id' => 'border', 'type' => 'select', 'std' => '', 'lockable' => true, 'subtype' => array( __( 'No Borders', 'avia_framework' ) => '', __( 'Borders on top and bottom', 'avia_framework' ) => 'av-border-top-bottom', __( 'Borders between cells', 'avia_framework' ) => 'av-border-cells', __( 'Borders on top and bottom and between cells', 'avia_framework' ) => 'av-border-top-bottom av-border-cells', ) ) ); $template = array( array( 'type' => 'template', 'template_id' => 'toggle', 'title' => __( 'Borders', 'avia_framework' ), 'content' => $c ), ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_borders' ), $template, true ); $c = array( array( 'name' => __( 'Custom minimum height', 'avia_framework' ), 'desc' => __( 'Do you want to use a custom or predefined minimum height?', 'avia_framework' ), 'id' => 'min_height_percent', 'type' => 'select', 'std' => '', 'lockable' => true, 'subtype' => array( __( 'At least 100% of Browser Window height', 'avia_framework' ) => '100', __( 'At least 75% of Browser Window height', 'avia_framework' ) => '75', __( 'At least 50% of Browser Window height', 'avia_framework' ) => '50', __( 'At least 25% of Browser Window height', 'avia_framework' ) => '25', __( 'Custom height in % based on browser windows height', 'avia_framework' ) => 'percent', __( 'Custom height in pixel', 'avia_framework' ) => '', ) ), array( 'name' => __( 'Section minimum custom height in %', 'avia_framework' ), 'desc' => __( 'Define a minimum height for the gridrow in % based on the browser windows height', 'avia_framework' ), 'id' => 'min_height_pc', 'type' => 'select', 'std' => '25', 'lockable' => true, 'required' => array( 'min_height_percent', 'equals', 'percent' ), 'subtype' => AviaHtmlHelper::number_array( 1, 99, 1 ) ), array( 'name' => __( 'Minimum height', 'avia_framework' ), 'desc' => __( 'Set the minimum height of all the cells in pixel. eg:400px', 'avia_framework' ), 'id' => 'min_height', 'type' => 'input', 'std' => '0', 'lockable' => true, 'required' => array( 'min_height_percent', 'equals', '' ) ) ); $template = array( array( 'type' => 'template', 'template_id' => 'toggle', 'title' => __( 'Height', 'avia_framework' ), 'content' => $c ), ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_height' ), $template, true ); $desc = __( 'The section will use the color scheme you select. Color schemes are defined on your styling page', 'avia_framework' ); $desc .= '
'; $desc .= __( '(Show Styling Page)', 'avia_framework' ) . ''; $c = array( array( 'name' => __( 'Section Colors', 'avia_framework' ), 'desc' => $desc, 'id' => 'color', 'type' => 'select', 'std' => 'main_color', 'lockable' => true, 'subtype' => array_flip( $avia_config['color_sets'] ) ), ); $template = array( array( 'type' => 'template', 'template_id' => 'toggle', 'title' => __( 'Colors', 'avia_framework' ), 'content' => $c ), ); AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_colors' ), $template, true ); } /** * 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['content'] = trim($params['content']); if(empty($params['content'])) $params['content'] = '[av_cell_one_half first][/av_cell_one_half] [av_cell_one_half][/av_cell_one_half]'; */ $default = array(); $locked = array(); $attr = $params['args']; $content = $params['content']; Avia_Element_Templates()->set_locked_attributes( $attr, $this, $this->config['shortcode'], $default, $locked, $content ); $args = $attr; // => extract( $params ); $name = $this->config['shortcode']; $data['shortcodehandler'] = $this->config['shortcode']; $data['modal_title'] = $this->config['name']; $data['modal_ajax_hook'] = $this->config['shortcode']; $data['dragdrop-level'] = $this->config['drag-level']; $data['allowed-shortcodes'] = $this->config['shortcode']; if( ! empty( $this->config['modal_on_load'] ) ) { $data['modal_on_load'] = $this->config['modal_on_load']; } $dataString = AviaHelper::create_data_string( $data ); if( $content ) { $final_content = $this->builder->do_shortcode_backend( $content ); $text_area = ShortcodeHelper::create_shortcode_by_array( $name, $content, $args ); } else if( Avia_Element_Templates()->is_edit_element_page() ) { $cell = new avia_sc_cell( $this->builder ); $params = array( 'content' => '', 'args' => array(), 'data' => '' ); $final_content = $cell->editor_element( $params ); $text_area = ShortcodeHelper::create_shortcode_by_array( $name, '[av_cell_one_full][/av_cell_one_full]', $args ); } else { $cell = new avia_sc_cell_one_half( $this->builder ); $params = array( 'content' => '', 'args' => array(), 'data' => '' ); $final_content = $cell->editor_element( $params ); $final_content .= $cell->editor_element( $params ); $text_area = ShortcodeHelper::create_shortcode_by_array( $name, '[av_cell_one_half][/av_cell_one_half] [av_cell_one_half][/av_cell_one_half]', $args ); } $title_id = ! empty( $args['id'] ) ? ': ' . ucfirst( $args['id'] ) : ''; $hidden_el_active = ! empty( $args['av_element_hidden_in_editor'] ) ? 'av-layout-element-closed' : ''; $output = "
"; $output .= "'; $output .= "
"; $output .= ""; $output .= $final_content; $output .= '
'; $output .= "" . __( 'Grid Row content hidden. Click here to show it', 'avia_framework' ) . ''; $output .= '
'; $output .= "" . __( 'Set Cell Size', 'avia_framework' ) . ''; $output .= "" . __( 'Add Cell', 'avia_framework' ) . ''; $output .= '
'; $output .= '
'; return $output; } /** * Create custom stylings * * @since 4.8.7 * @param array $args * @return array */ protected function get_element_styles( array $args ) { $result = parent::get_element_styles( $args ); extract( $result ); $default = array( 'color' => 'main_color', 'border' => '', 'min_height' => '0', 'min_height_percent' => '', 'min_height_pc' => 25, 'mobile' => 'av-flex-cells', 'mobile_breaking' => '', 'mobile_column_order' => '', 'id' => '' ); $default = $this->sync_sc_defaults_array( $default, 'no_modal_item', 'no_content' ); $atts = shortcode_atts( $default, $atts, $this->config['shortcode'] ); if( 'percent' == $atts['min_height_percent'] ) { $atts['min_height_percent'] = $atts['min_height_pc']; } // make global for content inside avia_sc_cell::$attr = $atts; $classes = array( 'av-layout-grid-container', $element_id, 'entry-content-wrapper', $atts['color'], $atts['border'], $atts['mobile'], $atts['mobile_breaking'], ); $element_styling->add_classes( 'section', $classes ); $element_styling->add_classes_from_array( 'section', $meta, 'el_class' ); if( $atts['mobile_column_order'] != '' ) { $element_styling->add_classes( 'section', 'av-grid-order-' . $atts['mobile_column_order'] ); } if( $atts['min_height_percent'] != '' ) { $element_styling->add_classes( 'section', array( 'av-cell-min-height', 'av-cell-min-height-' . $atts['min_height_percent'] ) ); } if( isset( $meta['index'] ) && $meta['index'] > 0 ) { $element_styling->add_classes( 'section', 'grid-row-not-first' ); } $selectors = array( 'section' => ".av-layout-grid-container.{$element_id}", ); $element_styling->add_selectors( $selectors ); $result['default'] = $default; $result['atts'] = $atts; $result['content'] = $content; $result['element_styling'] = $element_styling; return $result; } /** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler( $atts, $content = '', $shortcodename = '', $meta = '' ) { $result = $this->get_element_styles( compact( array( 'atts', 'content', 'shortcodename', 'meta' ) ) ); extract( $result ); extract( AviaHelper::av_mobile_sizes( $atts ) ); //return $av_font_classes, $av_title_font_classes and $av_display_classes extract( $atts ); avia_sc_grid_row::$count++; $params = array(); $params['open_structure'] = false; $params['id'] = AviaHelper::save_string( $id, '-', 'av-layout-grid-' . avia_sc_grid_row::$count ); $params['custom_markup'] = $meta['custom_markup']; $params['aria_label'] = $meta['aria_label']; $params['data'] = ''; if( $min_height_percent != '' ) { $params['data'] .= " data-av_minimum_height_pc='{$min_height_percent}'"; } //we dont need a closing structure if the element is the first one or if a previous fullwidth element was displayed before if( isset($meta['index'] ) && $meta['index'] == 0) { $params['close'] = false; } if( ! empty( $meta['siblings']['prev']['tag'] ) && in_array( $meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section ) ) { $params['close'] = false; } $params['class'] = $element_styling->get_class_string( 'section' ); $params['class'] .= " {$av_display_classes}"; // execute content $cells_content = ShortcodeHelper::avia_remove_autop( $content, true ); $style_tag = $element_styling->get_style_tag( $element_id ); // $container_class = $element_styling->get_class_string( 'container' ); $output = ''; $output .= $style_tag; $output .= avia_new_section( $params ); $output .= $cells_content; $output .= avia_section_after_element_content( $meta , 'after_grid_row_' . avia_sc_grid_row::$count, false ); // added to fix https://kriesi.at/support/topic/footer-disseapearing/#post-427764 avia_sc_section::$close_overlay = ''; return $output; } } }