config['self_closing'] = 'no'; $this->config['name'] = __('Special Heading', 'avia_framework' ); $this->config['tab'] = __('Content Elements', 'avia_framework' ); $this->config['icon'] = AviaBuilder::$path['imagesURL']."sc-heading.png"; $this->config['order'] = 93; $this->config['target'] = 'avia-target-insert'; $this->config['shortcode'] = 'av_heading'; $this->config['modal_data'] = array('modal_class' => 'mediumscreen'); $this->config['tooltip'] = __('Creates a special Heading', 'avia_framework' ); $this->config['preview'] = true; $this->config['disabling_allowed'] = true; } function extra_assets() { //load css wp_enqueue_style( 'avia-module-heading' , AviaBuilder::$path['pluginUrlRoot'].'avia-shortcodes/heading/heading.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() { $font_size_array = array( __("Default Size", 'avia_framework' ) => '', __("Flexible font size (adjusts to screen width)" , 'avia_framework') => AviaHtmlHelper::number_array(3,7,0.5 , array(), "vw", "", "vw"), __("Fixed font size" , 'avia_framework') => AviaHtmlHelper::number_array(11,150,1, array(), "px", "", "") ); $this->elements = array( array( "type" => "tab_container", 'nodescription' => true ), array( "type" => "tab", "name" => __("Content" , 'avia_framework'), 'nodescription' => true ), array( "name" => __("Heading Text", 'avia_framework' ), "id" => "heading", 'container_class' =>"avia-element-fullwidth", "std" => __("Hello", 'avia_framework' ), "type" => "input"), array( "name" => __("Heading Type", 'avia_framework' ), "desc" => __("Select which kind of heading you want to display.", 'avia_framework' ), "id" => "tag", "type" => "select", "std" => "h3", "subtype" => array("H1"=>'h1',"H2"=>'h2',"H3"=>'h3',"H4"=>'h4',"H5"=>'h5',"H6"=>'h6') ), array( "name" => __( "Apply a link to the header text?", 'avia_framework' ), "desc" => __( "You can choose to wrap the header in a link", 'avia_framework' ), "id" => "link_apply", "type" => "select", "std" => "", "subtype" => array( __('No Link for this header', 'avia_framework' ) => '', __('Apply Link to header', 'avia_framework' ) => 'header_link' ) ), array( "name" => __( "Header Text Link?", 'avia_framework' ), "desc" => __( "Where should the header text link to?", 'avia_framework' ), "id" => "link", "required" => array( 'link_apply', 'equals', 'header_link' ), "type" => "linkpicker", "fetchTMPL" => true, "std" => "", "subtype" => array( __( 'Set Manually', 'avia_framework' ) => 'manually', __( 'Single Entry', 'avia_framework' ) => 'single', __( 'Taxonomy Overview Page', 'avia_framework' ) => 'taxonomy', ), ), array( "name" => __( "Open Link in new Window?", 'avia_framework' ), "desc" => __( "Select here if you want to open the linked page in a new window", 'avia_framework' ), "id" => "link_target", "type" => "select", "std" => "", "required" => array( 'link', 'not_empty_and', 'lightbox' ), "subtype" => AviaHtmlHelper::linking_options() ), array( "name" => __("Heading Style", 'avia_framework' ), "desc" => __("Select a heading style", 'avia_framework' ), "id" => "style", "type" => "select", "std" => "", "subtype" => array( __("Default Style", 'avia_framework' )=>'', __("Heading Style Modern (left)", 'avia_framework' )=>'blockquote modern-quote' , __("Heading Style Modern (centered)", 'avia_framework' )=>'blockquote modern-quote modern-centered', __("Heading Style Classic (centered, italic)", 'avia_framework' )=>'blockquote classic-quote') ), array( "name" => __("Heading Size", 'avia_framework' ), "desc" => __("Size of your Heading in Pixel or Viewport Width", 'avia_framework' ), "id" => "size", "type" => "select", "subtype" => $font_size_array, "required" => array('style','not',''), "std" => ""), array( "name" => __("Subheading", 'avia_framework' ), "desc" => __("Add an extra descriptive subheading above or below the actual heading", 'avia_framework' ), "id" => "subheading_active", "type" => "select", "std" => "", "required" => array('style','not',''), "subtype" => array( __("No Subheading", 'avia_framework' )=>'', __("Display subheading above", 'avia_framework' ) =>'subheading_above', __("Display subheading below", 'avia_framework' )=>'subheading_below'), ), array( "name" => __("Subheading Text",'avia_framework' ), "desc" => __("Add your subheading here",'avia_framework' ), "id" => "content", "type" => "textarea", "required" => array('subheading_active','not',''), "std" => ""), array( "name" => __("Subheading Size", 'avia_framework' ), "desc" => __("Size of your subeading in Pixel", 'avia_framework' ), "id" => "subheading_size", "type" => "select", "subtype" => AviaHtmlHelper::number_array(10,40,1), "required" => array('subheading_active','not',''), "std" => "15"), array( "type" => "close_div", 'nodescription' => true ), array( "type" => "tab", "name" => __("Spacing",'avia_framework' ), 'nodescription' => true ), array( "name" => __("Margin", 'avia_framework' ), "desc" => __("Set the distance from the content to other elements here. Leave empty for default value. Both pixel and % based values are accepted. eg: 30px, 5% ", 'avia_framework' ), "id" => "margin", "type" => "multi_input", "std" => ",,,,", "sync" => true, "multi" => array( 'top' => __('Margin-Top','avia_framework'), 'right' => __('Margin-Right','avia_framework'), 'bottom'=> __('Margin-Bottom','avia_framework'), 'left' => __('Margin-Left','avia_framework'), ) ), array( "name" => __("Padding Bottom", 'avia_framework' ), "desc" => __("Bottom Padding in pixel", 'avia_framework' ), "id" => "padding", "type" => "select", "subtype" => AviaHtmlHelper::number_array(0,120,1), "std" => "10"), array( "type" => "close_div", 'nodescription' => true ), array( "type" => "tab", "name" => __("Colors",'avia_framework' ), 'nodescription' => true ), array( "name" => __("Heading Color", 'avia_framework' ), "desc" => __("Select a heading color", 'avia_framework' ), "id" => "color", "type" => "select", "std" => "", "subtype" => array( __("Default Color", 'avia_framework' )=>'', __("Meta Color", 'avia_framework' )=>'meta-heading', __("Custom Color", 'avia_framework' )=>'custom-color-heading') ), array( "name" => __("Custom Font Color", 'avia_framework' ), "desc" => __("Select a custom font color for your Heading here", 'avia_framework' ), "id" => "custom_font", "type" => "colorpicker", "std" => "", "required" => array('color','equals','custom-color-heading') ), array( "type" => "close_div", 'nodescription' => true ), array( "type" => "tab", "name" => __("Screen Options",'avia_framework' ), 'nodescription' => true ), array( "name" => __("Element Visibility",'avia_framework' ), "desc" => __("Set the visibility for this element, based on the device screensize.", 'avia_framework' ), "type" => "heading", "description_class" => "av-builder-note av-neutral", ), array( "desc" => __("Hide on large screens (wider than 990px - eg: Desktop)", 'avia_framework'), "id" => "av-desktop-hide", "std" => "", "container_class" => 'av-multi-checkbox', "type" => "checkbox"), array( "desc" => __("Hide on medium sized screens (between 768px and 989px - eg: Tablet Landscape)", 'avia_framework'), "id" => "av-medium-hide", "std" => "", "container_class" => 'av-multi-checkbox', "type" => "checkbox"), array( "desc" => __("Hide on small screens (between 480px and 767px - eg: Tablet Portrait)", 'avia_framework'), "id" => "av-small-hide", "std" => "", "container_class" => 'av-multi-checkbox', "type" => "checkbox"), array( "desc" => __("Hide on very small screens (smaller than 479px - eg: Smartphone Portrait)", 'avia_framework'), "id" => "av-mini-hide", "std" => "", "container_class" => 'av-multi-checkbox', "type" => "checkbox"), array( "name" => __("Heading Font Size",'avia_framework' ), "desc" => __("Set the font size for the heading, based on the device screensize.", 'avia_framework' ), "type" => "heading", "description_class" => "av-builder-note av-neutral", ), array( "name" => __("Font Size for medium sized screens (between 768px and 989px - eg: Tablet Landscape)", 'avia_framework' ), "id" => "av-medium-font-size-title", "type" => "select", "subtype" => AviaHtmlHelper::number_array(10,120,1, array( __("Default", 'avia_framework' )=>'' , __("Hidden", 'avia_framework' )=>'hidden' ), "px"), "std" => ""), array( "name" => __("Font Size for small screens (between 480px and 767px - eg: Tablet Portrait)", 'avia_framework' ), "id" => "av-small-font-size-title", "type" => "select", "subtype" => AviaHtmlHelper::number_array(10,120,1, array( __("Default", 'avia_framework' )=>'', __("Hidden", 'avia_framework' )=>'hidden'), "px"), "std" => ""), array( "name" => __("Font Size for very small screens (smaller than 479px - eg: Smartphone Portrait)", 'avia_framework' ), "id" => "av-mini-font-size-title", "type" => "select", "subtype" => AviaHtmlHelper::number_array(10,120,1, array( __("Default", 'avia_framework' )=>'', __("Hidden", 'avia_framework' )=>'hidden'), "px"), "std" => ""), array( "name" => __("Subheading Font Size",'avia_framework' ), "desc" => __("Set the font size for the subheading, based on the device screensize.", 'avia_framework' ), "type" => "heading", "description_class" => "av-builder-note av-neutral", ), array( "name" => __("Font Size for medium sized screens (between 768px and 989px - eg: Tablet Landscape)", 'avia_framework' ), "id" => "av-medium-font-size", "type" => "select", "subtype" => AviaHtmlHelper::number_array(10,120,1, array( __("Default", 'avia_framework' )=>'', __("Hidden", 'avia_framework' )=>'hidden'), "px"), "std" => ""), array( "name" => __("Font Size for small screens (between 480px and 767px - eg: Tablet Portrait)", 'avia_framework' ), "id" => "av-small-font-size", "type" => "select", "subtype" => AviaHtmlHelper::number_array(10,120,1, array( __("Default", 'avia_framework' )=>'', __("Hidden", 'avia_framework' )=>'hidden'), "px"), "std" => ""), array( "name" => __("Font Size for very small screens (smaller than 479px - eg: Smartphone Portrait)", 'avia_framework' ), "id" => "av-mini-font-size", "type" => "select", "subtype" => AviaHtmlHelper::number_array(10,120,1, array( __("Default", 'avia_framework' )=>'', __("Hidden", 'avia_framework' )=>'hidden'), "px"), "std" => ""), array( "type" => "close_div", 'nodescription' => true ), array( "type" => "close_div", 'nodescription' => 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['args'] = shortcode_atts( array( 'heading' => '', 'tag' => 'h3', 'link_apply' => '', 'link' => '', 'link_target' => '', 'style' => '', 'size' => '', 'subheading_active' => '', 'subheading_size' =>'', 'margin' => '', 'padding' => '5', 'color' => '', 'custom_font' => '', 'custom_class' => '', 'admin_preview_bg' => '', 'av-desktop-hide' => '', 'av-medium-hide' => '', 'av-small-hide' => '', 'av-mini-hide' => '', 'av-medium-font-size-title' => '', 'av-small-font-size-title' => '', 'av-mini-font-size-title' => '', 'av-medium-font-size' => '', 'av-small-font-size' => '', 'av-mini-font-size' => '' ), $params['args'], $this->config['shortcode'] ); $templateNAME = $this->update_template("name", "{{name}}"); $content = stripslashes(wpautop(trim(html_entity_decode( $params['content']) ))); $params['class'] = ""; $params['innerHtml'] = "