shopp_js_settings

filters localization settings passed to javascript environment on the storefront.

add_filter( 'shopp_js_settings', [callback] )

@param array $settings localization settings passed to javascript environment.

Description

filters localization settings passed to javascript environment on the storefront.

Example

// register filter callback
add_filter('shopp_js_settings', 'shopp_js_settings_filter');

// create filter function
function shopp_js_settings_filter( $settings ) {
    // alter settings
    if (shopp_script_is('calendar')) {
        $calendar = array(
            // Month names
            'month_jan' => __('January','Shopp'),
            'month_feb' => __('February','Shopp'),
            'month_mar' => __('March','Shopp'),
            'month_apr' => __('April','Shopp'),
            'month_may' => __('May','Shopp'),
            'month_jun' => __('June','Shopp'),
            'month_jul' => __('July','Shopp'),
            'month_aug' => __('August','Shopp'),
            'month_sep' => __('September','Shopp'),
            'month_oct' => __('October','Shopp'),
            'month_nov' => __('November','Shopp'),
            'month_dec' => __('December','Shopp'),

            // Weekday names
            'weekday_sun' => __('Sun','Shopp'),
            'weekday_mon' => __('Mon','Shopp'),
            'weekday_tue' => __('Tue','Shopp'),
            'weekday_wed' => __('Wed','Shopp'),
            'weekday_thu' => __('Thu','Shopp'),
            'weekday_fri' => __('Fri','Shopp'),
            'weekday_sat' => __('Sat','Shopp')
        );
    }

    // Admin only
    if (defined('WP_ADMIN'))
        $base['UNSAVED_CHANGES_WARNING'] = __('There are unsaved changes that will be lost if you continue.','Shopp');

    // see Shopp::settingsjs() for more details
    return array_merge($settings, $calendar, $base);
}

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar