CYBER MONDAY - 30% OFF Use coupon CM30 at checkout - Learn more

wsf_config_frameworks

Description

The wsf_config_frameworks filter runs when WS Form is preparing data for the current framework used to render a form. It can be used to manipulate features of the framework such as breakpoints sizes.

Usage

add_filter( 'wsf_config_frameworks', 'my_hook_function', 10, 3 );

Parameters

  1. $frameworks Array
    An array of the frameworks being used in the current view. On the public side this will be the currently selected framework.
  2. $framework String
    The currently selected framework ID, e.g. ws-form
  3. $public Boolean
    Whether or not the frameworks are being built on the public side. True if public, false if admin.

Example

// Callback function for the wsf_config_frameworks filter hook
function my_hook_function( $frameworks, $framework, $public ) {

    // Get framework breakpoints
    $breakpoints = $frameworks['types'][$framework]['breakpoints'];

    // Extra small (ID: 25) always 0

    // Small (ID: 50)
    $breakpoints[50]['min_width'] = 576;    // Small breakpoint size in pixels

    // Medium (ID: 75)
    $breakpoints[75]['min_width'] = 768;    // Medium breakpoint size in pixels

    // Large (ID: 100)
    $breakpoints[100]['min_width'] = 992;   // Large breakpoint size in pixels

    // Extra large (ID: 150)
    $breakpoints[150]['min_width'] = 1200;  // Extra large breakpoint size in pixels

    // Set admin breakpoint settings so that sizes are reflected in layout editor
    $breakpoints[25]['admin_max_width'] = $breakpoints[50]['min_width'] - 1;
    $breakpoints[50]['admin_max_width'] = $breakpoints[75]['min_width'] - 1;
    $breakpoints[75]['admin_max_width'] = $breakpoints[100]['min_width'] - 1;
    $breakpoints[100]['admin_max_width'] = $breakpoints[150]['min_width'] - 1;

    // Set framework breakpoints
    $frameworks['types'][$framework]['breakpoints'] = $breakpoints;

    // Return frameworks with adjusted breakpoints
    return $frameworks;
}

// Add a callback function for the wsf_config_frameworks filter hook add_filter( 'wsf_config_frameworks', 'my_hook_function', 10, 3 );

Source File

This hook can be found in: <plugin root>/includes/class-ws-form-config.php