[WIP][Accessibility] Add field for the email footer text color (#49648)

Co-authored-by: amesplant <95257231+amesplant-dmv@users.noreply.github.com>
Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Ames Plant 2024-08-02 10:14:21 -05:00 committed by GitHub
parent 67ab34aab2
commit dbc3056845
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 49 additions and 20 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add field for the email footer text color

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add an additional field for the email settings that sets the footer text color

View File

@ -130,19 +130,6 @@ class WC_Settings_Emails extends WC_Settings_Page {
'desc_tip' => true, 'desc_tip' => true,
), ),
array(
'title' => __( 'Footer text', 'woocommerce' ),
/* translators: %s: Available placeholders for use */
'desc' => __( 'The text to appear in the footer of all WooCommerce emails.', 'woocommerce' ) . ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title} {site_url}' ),
'id' => 'woocommerce_email_footer_text',
'css' => 'width:400px; height: 75px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'type' => 'textarea',
'default' => '{site_title} &mdash; Built with {WooCommerce}',
'autoload' => false,
'desc_tip' => true,
),
array( array(
'title' => __( 'Base color', 'woocommerce' ), 'title' => __( 'Base color', 'woocommerce' ),
/* translators: %s: default color */ /* translators: %s: default color */
@ -191,6 +178,31 @@ class WC_Settings_Emails extends WC_Settings_Page {
'desc_tip' => true, 'desc_tip' => true,
), ),
array(
'title' => __( 'Footer text', 'woocommerce' ),
/* translators: %s: Available placeholders for use */
'desc' => __( 'The text to appear in the footer of all WooCommerce emails.', 'woocommerce' ) . ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title} {site_url}' ),
'id' => 'woocommerce_email_footer_text',
'css' => 'width:400px; height: 75px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'type' => 'textarea',
'default' => '{site_title} &mdash; Built with {WooCommerce}',
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Footer text color', 'woocommerce' ),
/* translators: %s: footer default color */
'desc' => sprintf( __( 'The footer text color. Default %s.', 'woocommerce' ), '<code>#3c3c3c</code>' ),
'id' => 'woocommerce_email_footer_text_color',
'type' => 'color',
'css' => 'width:6em;',
'default' => '#3c3c3c',
'autoload' => false,
'desc_tip' => true,
),
array( array(
'type' => 'sectionend', 'type' => 'sectionend',
'id' => 'email_template_options', 'id' => 'email_template_options',

View File

@ -12,7 +12,7 @@
* *
* @see https://woocommerce.com/document/template-structure/ * @see https://woocommerce.com/document/template-structure/
* @package WooCommerce\Templates\Emails * @package WooCommerce\Templates\Emails
* @version 8.6.0 * @version 9.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -20,11 +20,12 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
// Load colors. // Load colors.
$bg = get_option( 'woocommerce_email_background_color' ); $bg = get_option( 'woocommerce_email_background_color' );
$body = get_option( 'woocommerce_email_body_background_color' ); $body = get_option( 'woocommerce_email_body_background_color' );
$base = get_option( 'woocommerce_email_base_color' ); $base = get_option( 'woocommerce_email_base_color' );
$base_text = wc_light_or_dark( $base, '#202020', '#ffffff' ); $base_text = wc_light_or_dark( $base, '#202020', '#ffffff' );
$text = get_option( 'woocommerce_email_text_color' ); $text = get_option( 'woocommerce_email_text_color' );
$footer_text = get_option( 'woocommerce_email_footer_text_color' );
// Pick a contrasting color for links. // Pick a contrasting color for links.
$link_color = wc_hex_is_light( $base ) ? $base : $base_text; $link_color = wc_hex_is_light( $base ) ? $base : $base_text;
@ -97,7 +98,7 @@ body {
#template_footer #credit { #template_footer #credit {
border: 0; border: 0;
color: <?php echo esc_attr( $text_lighter_40 ); ?>; color: <?php echo esc_attr( $footer_text ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 12px; font-size: 12px;
line-height: 150%; line-height: 150%;
@ -190,6 +191,11 @@ body {
display: block; display: block;
} }
#template_footer #credit,
#template_footer #credit a {
color: <?php echo esc_attr( $footer_text ); ?>;
}
h1 { h1 {
color: <?php echo esc_attr( $base ); ?>; color: <?php echo esc_attr( $base ); ?>;
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;

View File

@ -82,6 +82,7 @@ class WC_Settings_Emails_Test extends WC_Settings_Unit_Test_Case {
'woocommerce_email_background_color' => 'color', 'woocommerce_email_background_color' => 'color',
'woocommerce_email_body_background_color' => 'color', 'woocommerce_email_body_background_color' => 'color',
'woocommerce_email_text_color' => 'color', 'woocommerce_email_text_color' => 'color',
'woocommerce_email_footer_text_color' => 'color',
'email_merchant_notes' => array( 'title', 'sectionend' ), 'email_merchant_notes' => array( 'title', 'sectionend' ),
'woocommerce_merchant_email_notifications' => 'checkbox', 'woocommerce_merchant_email_notifications' => 'checkbox',
); );

View File

@ -2944,6 +2944,8 @@ importers:
specifier: ^3.0.15 specifier: ^3.0.15
version: 3.0.15 version: 3.0.15
plugins/tiktok-for-business: {}
plugins/woo-ai: plugins/woo-ai:
dependencies: dependencies:
'@automattic/tour-kit': '@automattic/tour-kit':