1

I'm developing a new param type by following this guide. This new param type will contain a color picker and 3 text fields.To use VC's in-built colorpicker, made a littre research and found these codes from js_composer/include/params//colorpicker/colorpicker.php

function vc_colorpicker_form_field( $settings, $value ) {
    return '<div class="color-group">'
           . '<input name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textinput ' . $settings['param_name'] . ' ' . $settings['type'] . '_field vc_color-control" type="text" value="' . $value . '"/>'
           . '</div>';
}

So copied codes from here to my custom param:

add_shortcode_param( 'my_param', array($this, 'my_param_settings_field') );
function my_param_settings_field( $settings, $value ) {
           return '<div class="color-group">'
           . '<input name="' . $settings['param_name'] . '" class="wpb_vc_param_value wpb-textinput ' . $settings['param_name'] . ' ' . $settings['type'] . '_field vc_color-control" type="text" value="' . $value . '"/>'
           . '</div>'
           . '<input ...>'
           . '<input ...>';
        }

But this is the result:

enter image description here

As you see there are 3 text fields, first one didn't become a color picker.

How can I use in-built VC param types (like colorpicker) in my custom param types?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.