/** * Parses shortcode attributes and set defaults based on vc_map function relative to shortcode and fields names * * @param $atts * * @since 4.3 * @return array */ public function getAttributes($atts) { /** * Shortcode attributes * @var $text * @var $google_fonts * @var $font_container * @var $el_class * @var $link * @var $css */ $atts = vc_map_get_attributes($this->getShortcode(), $atts); extract($atts); /** * Get default values from VC_MAP. **/ $google_fonts_field = $this->getParamData('google_fonts'); $font_container_field = $this->getParamData('font_container'); $el_class = $this->getExtraClass($el_class); $font_container_obj = new Vc_Font_Container(); $google_fonts_obj = new Vc_Google_Fonts(); $font_container_field_settings = isset($font_container_field['settings'], $font_container_field['settings']['fields']) ? $font_container_field['settings']['fields'] : array(); $google_fonts_field_settings = isset($google_fonts_field['settings'], $google_fonts_field['settings']['fields']) ? $google_fonts_field['settings']['fields'] : array(); $font_container_data = $font_container_obj->_vc_font_container_parse_attributes($font_container_field_settings, $font_container); $google_fonts_data = strlen($google_fonts) > 0 ? $google_fonts_obj->_vc_google_fonts_parse_attributes($google_fonts_field_settings, $google_fonts) : ''; return array('text' => isset($text) ? $text : '', 'google_fonts' => $google_fonts, 'font_container' => $font_container, 'el_class' => $el_class, 'css' => $css, 'link' => 0 === strpos($link, '|') ? false : $link, 'font_container_data' => $font_container_data, 'google_fonts_data' => $google_fonts_data); }
public function getAttributes($atts) { $text = $google_fonts = $font_container = $el_class = $css = ''; /** * Get default values from VC_MAP. **/ $google_fonts_field = WPBMap::getParam('vc_custom_heading', 'google_fonts'); $font_container_field = WPBMap::getParam('vc_custom_heading', 'font_container'); $el_class_field = WPBMap::getParam('vc_custom_heading', 'el_class'); $css_field = WPBMap::getParam('vc_custom_heading', 'css'); $text_field = WPBMap::getParam('vc_custom_heading', 'text'); extract(shortcode_atts(array('text' => isset($text_field['value']) ? $text_field['value'] : '', 'google_fonts' => isset($google_fonts_field['value']) ? $google_fonts_field['value'] : '', 'font_container' => isset($font_container_field['value']) ? $font_container_field['value'] : '', 'el_class' => isset($el_class_field['value']) ? $el_class_field['value'] : '', 'css' => isset($css_field['value']) ? $css_field['value'] : ''), $atts)); $el_class = $this->getExtraClass($el_class); $font_container_obj = new Vc_Font_Container(); $google_fonts_obj = new Vc_Google_Fonts(); $font_container_field_settings = isset($font_container_field['settings'], $font_container_field['settings']['fields']) ? $font_container_field['settings']['fields'] : array(); $google_fonts_field_settings = isset($google_fonts_field['settings'], $google_fonts_field['settings']['fields']) ? $google_fonts_field['settings']['fields'] : array(); $font_container_data = $font_container_obj->_vc_font_container_parse_attributes($font_container_field_settings, $font_container); $google_fonts_data = $google_fonts_obj->_vc_google_fonts_parse_attributes($google_fonts_field_settings, $google_fonts); return array('text' => $text, 'google_fonts' => $google_fonts, 'font_container' => $font_container, 'el_class' => $el_class, 'css' => $css, 'font_container_data' => $font_container_data, 'google_fonts_data' => $google_fonts_data); }
/** * Function for rendering param in edit form (add element) * Parse settings from vc_map and entered values. * * @param $settings * @param $value * * @since 4.3 * vc_filter: vc_google_fonts_render_filter * @return mixed|void rendered template for params in edit form * */ function vc_google_fonts_form_field($settings, $value) { $google_fonts = new Vc_Google_Fonts(); return apply_filters('vc_google_fonts_render_filter', $google_fonts->render($settings, $value)); }