Make WordPress Core


Ignore:
Timestamp:
10/20/2020 06:24:33 PM (4 years ago)
Author:
desrosj
Message:

Twenty Twenty: Import the latest changes from GitHub

For a full list of changes since [49216], see https://github.com/WordPress/twentytwentyone/compare/dfe141276ca4b856bbcd748f9da108ddad026c4c...trunk/.

Props poena, melchoyce, luminuu, aristath, jffng, ryelle, kishanjasani, rolfsiebers, sresok, desrosj.
See #51526.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php

    r49216 r49247  
    4141
    4242            // Change site-title & description to postMessage.
    43             $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
    44             $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
     43            $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
     44            $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // @phpstan-ignore-line. Assume that this setting exists.
    4545
    4646            // Add partial for blogname.
     
    127127            $palette = get_theme_support( 'editor-color-palette' );
    128128
    129             // Build the colors array from our theme-support.
     129            // Build the colors array from theme-support.
    130130            $colors = array();
    131131            if ( isset( $palette[0] ) && is_array( $palette[0] ) ) {
     
    147147                )
    148148            );
     149
     150            $wp_customize->add_setting(
     151                'respect_user_color_preference',
     152                array(
     153                    'capability'        => 'edit_theme_options',
     154                    'default'           => true,
     155                    'sanitize_callback' => function( $value ) {
     156                        return (bool) $value;
     157                    },
     158                )
     159            );
     160
     161            $wp_customize->add_control(
     162                'respect_user_color_preference',
     163                array(
     164                    'type'            => 'checkbox',
     165                    'section'         => 'colors',
     166                    'label'           => esc_html__( 'Respect visitor\'s device dark mode settings', 'twentytwentyone' ),
     167                    'description'     => __( 'Dark mode is a device setting. If a visitor to your site requests it, your site will be shown with a dark background and light text.', 'twentytwentyone' ),
     168                    'active_callback' => function( $value ) {
     169                        return 127 < Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
     170                    },
     171                )
     172            );
    149173        }
    150174
Note: See TracChangeset for help on using the changeset viewer.