settings example

return static function DScalarNormalizedTypesConfig $config) {
    $config
        ->simpleArray('foo')
        ->keyedArray('key', 'value')
        ->object(true)
        ->listObject('bar')
        ->listObject('baz')
        ->listObject()->name('qux');

    $config
        ->keyedListObject('Foo\\Bar', true)
        ->keyedListObject('Foo\\Baz')->settings(['one', 'two']);

    $config->nested([
        'nested_object' => true,
        'nested_list_object' => ['one', 'two'],
    ]);
};
?> <script type="text/javascript"> var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>; _wpCustomizeSettings.initialClientTimestamp = _.now(); _wpCustomizeSettings.controls = {}; _wpCustomizeSettings.settings = {}; <?php
            // Serialize settings one by one to improve memory usage.             echo "(function ( s ){\n";
            foreach ( $this->settings() as $setting ) {
                if ( $setting->check_capabilities() ) {
                    printf(
                        "s[%s] = %s;\n",
                        wp_json_encode( $setting->id ),
                        wp_json_encode( $setting->json() )
                    );
                }
            }
            echo "})( _wpCustomizeSettings.settings );\n";

            // Serialize controls one by one to improve memory usage.

    public function call_widget_update( $widget_id ) {
        global $wp_registered_widget_updates$wp_registered_widget_controls;

        $setting_id = $this->get_setting_id( $widget_id );

        /* * Make sure that other setting changes have previewed since this widget * may depend on them (e.g. Menus being present for Navigation Menu widget). */
        if ( ! did_action( 'customize_preview_init' ) ) {
            foreach ( $this->manager->settings() as $setting ) {
                if ( $setting->id !== $setting_id ) {
                    $setting->preview();
                }
            }
        }

        $this->start_capturing_option_updates();
        $parsed_id   = $this->parse_widget_id( $widget_id );
        $option_name = 'widget_' . $parsed_id['id_base'];

        /* * If a previously-sanitized instance is provided, populate the input vars * with its values so that the widget update callback will read this instance */
if ( null !== $auto_add ) {
            $nav_menu_options = $this->filter_nav_menu_options_value(
                (array) get_option( 'nav_menu_options', array() ),
                $this->term_id,
                $auto_add
            );
            update_option( 'nav_menu_options', $nav_menu_options );
        }

        if ( 'inserted' === $this->update_status ) {
            // Make sure that new menus assigned to nav menu locations use their new IDs.             foreach ( $this->manager->settings() as $setting ) {
                if ( ! preg_match( '/^nav_menu_locations\[/', $setting->id ) ) {
                    continue;
                }

                $post_value = $setting->post_value( null );
                if ( ! is_null( $post_value ) && (int) $post_value === $this->previous_term_id ) {
                    $this->manager->set_post_value( $setting->id, $this->term_id );
                    $setting->save();
                }
            }

            
Home | Imprint | This part of the site doesn't use cookies.