Add button to insert shortcodes in WordPress page menu construction

I am studying how to do things for WordPress, I managed to make a plugin that creates a form with multiple screens and fields and buttons options.

So far the options that step shortcodes you need to know the code to know what options put and what keywords options. What I want is to add a button that opens a modal where it will to the User to set the options, then click insert and generates the shortcode on the page.

Read More

The menu I’m talking about is what is used to format the text of the page. The structure that is seen with the div class = "mce-toolbar-grp mce-container mce mce-panel-stack-layout-item mce-first".

To understand what I want to do this is an excerpt from my plugin:

function mf_container($atts, $content = null) {
    extract( shortcode_atts( array (
        "table" => false,
        "user" => false,
        "redirect" => false,
    ), $atts ) );
    if($user && !is_user_logged_in()){
        return  'É necessario estar logado';
    }

    $content = do_shortcode($content);
    $content = str_replace("<br />","",$content);
    $content = str_replace("<p>","",$content);
    $content = str_replace("</p>","",$content);

    $header = "<form action='' method='post'>
            <input type='hidden' name='action' value='mult_form_submited'/>";

    if ($table){
        $header .= "<input type='hidden' name='table' value='".$table."'/>";
    }

    if ($redirect){
        $header .= "<input type='hidden' name='redirect' value='".$redirect."'/>";
    }

    if($user == "logged"){
        $header .= "<input type='hidden' name='user' value='".$user."'/>";
    }

    return $header . $content . "</form>";
}

add_shortcode('mult_form','mf_container');

This code you can pass parameter, the options to generate a table through the table name in the “table”, pass the type of user options that have access to the form on the “user”, and if he wants after submit the answer he wants to be redirected to a specific page in the “redirect” option.

Does anyone know how I can do this? Which references the hook? I searched the codex, but so far I have no idea or how to look for it.

Thank you community!!!

Related posts