function ctools_plugins_default_form_wrapper

A wrapper to provide a default submit so that plugins don't have to duplicate a whole bunch of code to do what most of them want to do anyway.

1 string reference to 'ctools_plugins_default_form_wrapper'
_ctools_plugin_configure_create_form_info in includes/plugins-admin.inc

File

includes/plugins-admin.inc, line 177

Code

function ctools_plugins_default_form_wrapper($form, &$form_state) {
    $form_info =& $form_state['form_info'];
    $info = $form_info['forms'][$form_state['step']];
    if (isset($info['original wrapper']) && function_exists($info['original wrapper'])) {
        $form = $info['original wrapper']($form, $form_state);
    }
    if (isset($form['buttons']['next'])) {
        if (empty($form['buttons']['next']['#submit'])) {
            $form['buttons']['next']['#submit'] = $form['#submit'];
        }
        $form['buttons']['next']['#submit'][] = 'ctools_plugins_default_form_wrapper_submit';
    }
    if (isset($form['buttons']['return'])) {
        if (empty($form['buttons']['return']['#submit'])) {
            $form['buttons']['return']['#submit'] = $form['#submit'];
        }
        $form['buttons']['return']['#submit'][] = 'ctools_plugins_default_form_wrapper_submit';
    }
    return $form;
}