public function contentAdmin($atts, $content) { $this->loadDefaultParams(); $output = $el_position = ''; $groups_content = array(); if (isset($this->settings['params'])) { $shortcode_attributes = array(); foreach ($this->settings['params'] as $param) { if ($param['param_name'] != 'content') { if (isset($param['std'])) { $shortcode_attributes[$param['param_name']] = $param['std']; } else { $shortcode_attributes[$param['param_name']] = isset($param['value']) ? $param['value'] : null; } } else { if ($param['param_name'] == 'content' && $content === null) { $content = isset($param['value']) ? $param['value'] : ''; } } } extract(shortcode_atts($shortcode_attributes, $atts)); $editor_css_classes = apply_filters('vc_edit_form_class', array('wpb_edit_form_elements')); $output .= '<div class="' . implode(' ', $editor_css_classes) . '" data-title="' . htmlspecialchars(__('Edit', 'js_composer') . ' ' . __($this->settings['name'], "js_composer")) . '">'; foreach ($this->settings['params'] as $param) { $param_value = isset(${$param}['param_name']) ? ${$param}['param_name'] : ''; if (is_array($param_value) && !empty($param_value) && isset($param['std'])) { $param_value = $param['std']; } elseif (is_array($param_value) && !empty($param_value) && !empty($param['type']) && $param['type'] != 'checkbox') { // Get first element from the array reset($param_value); $first_key = key($param_value); $param_value = $param_value[$first_key]; } elseif (is_array($param_value)) { $param_value = ''; } $group = isset($param['group']) && $param['group'] !== '' ? $param['group'] : '_general'; if (!isset($groups_content[$group])) { $groups[] = $group; $groups_content[$group] = ''; } $groups_content[$group] .= $this->singleParamEditHolder($param, $param_value); } if (sizeof($groups) > 1) { $output .= '<div class="vc_panel-tabs" id="vc_edit-form-tabs"><ul>'; $key = 0; foreach ($groups as $g) { $output .= '<li><a href="#vc_edit-form-tab-' . $key++ . '">' . ($g === '_general' ? __('General', 'js_composer') : $g) . '</a></li>'; } $output .= '</ul>'; $key = 0; foreach ($groups as $g) { $output .= '<div id="vc_edit-form-tab-' . $key++ . '" class="vc_edit-form-tab">'; $output .= $groups_content[$g]; $output .= '</div>'; } $output .= '</div>'; } elseif (!empty($groups_content['_general'])) { $output .= $groups_content['_general']; } $output .= '</div>'; //close wpb_edit_form_elements if (!WpbakeryShortcodeParams::isEnqueue()) { foreach (WpbakeryShortcodeParams::getScripts() as $script) { $output .= "\n\n" . '<script type="text/javascript" src="' . $script . '"></script>'; } } } return $output; }
/** * Enqueue js scripts for attributes types. * @since 4.4 * @return string */ public function enqueueScripts() { $output = ''; if (!WpbakeryShortcodeParams::isEnqueue()) { $scripts = apply_filters('vc_edit_form_enqueue_script', WpbakeryShortcodeParams::getScripts()); foreach ($scripts as $script) { $output .= "\n\n" . '<script type="text/javascript" src="' . $script . '"></script>'; } } return $output; }
public function contentAdmin($atts, $content) { $this->loadDefaultParams(); $output = $el_position = ''; if (isset($this->settings['params'])) { $shortcode_attributes = array(); foreach ($this->settings['params'] as $param) { if ($param['param_name'] != 'content') { if (isset($param['std'])) { $shortcode_attributes[$param['param_name']] = $param['std']; } else { $shortcode_attributes[$param['param_name']] = isset($param['value']) ? $param['value'] : null; } } else { if ($param['param_name'] == 'content' && $content == NULL) { $content = $param['value']; } } } extract(shortcode_atts($shortcode_attributes, $atts)); $editor_css_classes = apply_filters('vc_edit_form_class', array('vc_span12', 'wpb_edit_form_elements')); $output .= '<div class="' . implode(' ', $editor_css_classes) . '" data-title="' . htmlspecialchars(__('Edit', 'js_composer') . ' ' . __($this->settings['name'], "js_composer")) . '">'; foreach ($this->settings['params'] as $param) { $param_value = isset(${$param}['param_name']) ? ${$param}['param_name'] : ''; if (is_array($param_value) && !empty($param_value) && isset($param['std'])) { $param_value = $param['std']; } elseif (is_array($param_value) && !empty($param_value) && !empty($param['type']) && $param['type'] != 'checkbox') { // Get first element from the array reset($param_value); $first_key = key($param_value); $param_value = $param_value[$first_key]; } elseif (is_array($param_value)) { $param_value = ''; } $output .= $this->singleParamEditHolder($param, $param_value); } $output .= '</div>'; //close wpb_edit_form_elements if (!WpbakeryShortcodeParams::isEnqueue()) { foreach (WpbakeryShortcodeParams::getScripts() as $script) { $output .= "\n\n" . '<script type="text/javascript" src="' . $script . '"></script>'; } } } return $output; }