コード例 #1
0
/**
 * Save settings preset for specific shortcode
 *
 * Include freshly rendered html in response
 *
 * Required _POST params:
 * - shortcode_name string
 * - title string
 * - data string params in json
 * - is_default
 *
 * @since 4.7
 */
function vc_action_save_settings_preset()
{
    vc_include_settings_preset_class();
    $id = Vc_Settings_Preset::saveSettingsPreset(vc_post_param('shortcode_name'), vc_post_param('title'), vc_post_param('data'), vc_post_param('is_default'));
    $response = array('success' => (bool) $id, 'html' => Vc_Settings_Preset::getRenderedSettingsPresetPopup(vc_post_param('shortcode_name')), 'id' => $id);
    wp_send_json($response);
}
コード例 #2
0
/**
 * Save settings preset for specific shortcode
 *
 * Include freshly rendered html in response
 *
 * Required _POST params:
 * - shortcode_name string
 * - title string
 * - data string params in json
 * - is_default
 *
 * @since 4.7
 */
function vc_action_save_settings_preset()
{
    vc_include_settings_preset_class();
    vc_user_access()->part('presets')->checkStateAny(true, null)->validateDie();
    // user must have permission to save presets
    $id = Vc_Settings_Preset::saveSettingsPreset(vc_post_param('shortcode_name'), vc_post_param('title'), vc_post_param('data'), vc_post_param('is_default'));
    $response = array('success' => (bool) $id, 'html' => Vc_Settings_Preset::getRenderedSettingsPresetPopup(vc_post_param('shortcode_name')), 'id' => $id);
    wp_send_json($response);
}