WC_Settings_Emails::get_settings_for_default_section │ protected │ WC 1.0
Get settings array.
Method of the class: WC_Settings_Emails{}
Hooks from the method
Returns
Array.
Usage
// protected - for code of main (parent) or child class $result = $this->get_settings_for_default_section();
WC_Settings_Emails::get_settings_for_default_section() WC Settings Emails::get settings for default section code WC 10.8.1
protected function get_settings_for_default_section() {
$desc_help_text = sprintf(
/* translators: %1$s: Link to WP Mail Logging plugin, %2$s: Link to Email FAQ support page. */
__( 'To ensure your store’s notifications arrive in your and your customers’ inboxes, we recommend connecting your email address to your domain and setting up a dedicated SMTP server. If something doesn’t seem to be sending correctly, install the <a href="%1$s">WP Mail Logging Plugin</a> or check the <a href="%2$s">Email FAQ page</a>.', 'woocommerce' ),
'https://wordpress.org/plugins/wp-mail-logging/',
'https://woocommerce.com/document/email-faq'
);
$block_email_editor_enabled = FeaturesUtil::feature_is_enabled( 'block_email_editor' );
$email_improvements_enabled = $this->get_email_improvements_enabled();
// These defaults should be chosen by the same logic as the other color option properties.
$default_colors = EmailColors::get_default_colors( $email_improvements_enabled );
if ( $block_email_editor_enabled ) {
$email_notifications_field = 'email_notification_block_emails';
$email_notifications_desc = null;
} else {
$email_notifications_field = 'email_notification';
/* translators: %s: help description with link to WP Mail logging and support page. */
$email_notifications_desc = sprintf( __( 'Email notifications sent from WooCommerce are listed below. Click on an email to configure it.<br>%s', 'woocommerce' ), $desc_help_text );
}
$settings =
array(
array(
'title' => __( 'Email notifications', 'woocommerce' ),
'desc' => $email_notifications_desc,
'type' => 'title',
'id' => 'email_notification_settings',
),
array( 'type' => $email_notifications_field ),
array(
'type' => 'sectionend',
'id' => 'email_notification_settings',
),
array(
'type' => 'sectionend',
'id' => 'email_recipient_options',
),
array(
'title' => __( 'Email sender options', 'woocommerce' ),
'type' => 'title',
'desc' => __( "Set the name and email address you'd like your outgoing emails to use.", 'woocommerce' ),
'id' => 'email_options',
),
array(
'title' => __( '"From" name', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_email_from_name',
'type' => 'text',
'css' => 'min-width:400px;',
'default' => esc_attr( get_bloginfo( 'name', 'display' ) ),
'autoload' => false,
'desc_tip' => true,
'skip_initial_save' => true,
),
array(
'title' => __( '"From" address', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_email_from_address',
'type' => 'email',
'custom_attributes' => array(
'multiple' => 'multiple',
),
'css' => 'min-width:400px;',
'default' => get_option( 'admin_email' ),
'autoload' => false,
'desc_tip' => true,
),
);
// Add reply-to fields when block email editor is enabled.
if ( $block_email_editor_enabled ) {
$settings = array_merge(
$settings,
array(
array(
'title' => __( 'Add "Reply-to" email', 'woocommerce' ),
'desc' => __( 'Add a different email address to receive replies.', 'woocommerce' ),
'id' => 'woocommerce_email_reply_to_enabled',
'type' => 'checkbox',
'default' => 'no',
'autoload' => false,
),
array(
'title' => __( '"Reply-to" name', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_email_reply_to_name',
'type' => 'text',
'css' => 'min-width:400px;',
'default' => '',
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( '"Reply-to" address', 'woocommerce' ),
'desc' => '',
'id' => 'woocommerce_email_reply_to_address',
'type' => 'email',
'css' => 'min-width:400px;',
'default' => '',
'autoload' => false,
'desc_tip' => true,
),
)
);
}
$settings = array_merge(
$settings,
array(
array(
'type' => 'sectionend',
'id' => 'email_options',
),
)
);
// If the email editor is enabled the design is handled by the email editor.
if ( ! $block_email_editor_enabled ) {
$settings = array_merge(
$settings,
array(
array(
'title' => __( 'Email template', 'woocommerce' ),
'type' => 'title',
'desc' => __( 'Customize your WooCommerce email template and preview it below.', 'woocommerce' ),
'id' => 'email_template_options',
),
array(
'title' => __( 'Try new templates', 'woocommerce' ),
'type' => 'previewing_new_templates',
'id' => 'previewing_new_templates',
),
array(
'title' => __( 'Logo', 'woocommerce' ),
'desc' => __( 'Add your logo to each of your WooCommerce emails. If no logo is uploaded, your site title will be used instead.', 'woocommerce' ),
'id' => 'woocommerce_email_header_image',
'type' => 'email_image_url',
'css' => 'min-width:400px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'default' => '',
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Logo width (px)', 'woocommerce' ),
'id' => 'woocommerce_email_header_image_width',
'desc_tip' => '',
'default' => '120',
'type' => 'number',
'row_class' => $email_improvements_enabled ? '' : 'disabled',
),
array(
'title' => __( 'Header alignment', 'woocommerce' ),
'id' => 'woocommerce_email_header_alignment',
'desc_tip' => '',
'default' => 'left',
'type' => 'select',
'class' => 'wc-enhanced-select',
'options' => array(
'left' => __( 'Left', 'woocommerce' ),
'center' => __( 'Center', 'woocommerce' ),
'right' => __( 'Right', 'woocommerce' ),
),
'row_class' => $email_improvements_enabled ? '' : 'disabled',
),
array(
'title' => __( 'Font family', 'woocommerce' ),
'id' => 'woocommerce_email_font_family',
'default' => 'Helvetica',
'type' => 'email_font_family',
'row_class' => $email_improvements_enabled ? '' : 'disabled',
),
array(
'title' => __( 'Footer text', 'woocommerce' ),
/* translators: %s: Available placeholders for use */
'desc' => __( 'This text will appear in the footer of all of your WooCommerce emails.', 'woocommerce' ) . ' ' . sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title} {site_url} {store_address} {store_email}' ),
'id' => 'woocommerce_email_footer_text',
'css' => 'width:400px; height: 75px;',
'placeholder' => __( 'N/A', 'woocommerce' ),
'type' => 'textarea',
'default' => '{site_title}<br />{store_address}',
'autoload' => false,
'desc_tip' => true,
),
array(
'type' => 'sectionend',
'id' => 'email_template_options',
),
array(
'title' => __( 'Color palette', 'woocommerce' ),
'type' => 'email_color_palette',
'id' => 'email_color_palette',
),
array(
'title' => __( 'Accent', 'woocommerce' ),
/* translators: %s: default color */
'desc' => sprintf( __( 'Customize the color of your buttons and links. Default %s.', 'woocommerce' ), '<code>' . $default_colors['base'] . '</code>' ),
'id' => 'woocommerce_email_base_color',
'type' => 'color',
'css' => 'width:6em;',
'default' => $default_colors['base'],
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Email background', 'woocommerce' ),
/* translators: %s: default color */
'desc' => sprintf( __( 'Select a color for the background of your emails. Default %s.', 'woocommerce' ), '<code>' . $default_colors['bg'] . '</code>' ),
'id' => 'woocommerce_email_background_color',
'type' => 'color',
'css' => 'width:6em;',
'default' => $default_colors['bg'],
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Content background', 'woocommerce' ),
/* translators: %s: default color */
'desc' => sprintf( __( 'Choose a background color for the content area of your emails. Default %s.', 'woocommerce' ), '<code>' . $default_colors['body_bg'] . '</code>' ),
'id' => 'woocommerce_email_body_background_color',
'type' => 'color',
'css' => 'width:6em;',
'default' => $default_colors['body_bg'],
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Heading & text', 'woocommerce' ),
/* translators: %s: default color */
'desc' => sprintf( __( 'Set the color of your headings and text. Default %s.', 'woocommerce' ), '<code>' . $default_colors['body_text'] . '</code>' ),
'id' => 'woocommerce_email_text_color',
'type' => 'color',
'css' => 'width:6em;',
'default' => $default_colors['body_text'],
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Secondary text', 'woocommerce' ),
/* translators: %s: footer default color */
'desc' => sprintf( __( 'Choose a color for your secondary text, such as your footer content. Default %s.', 'woocommerce' ), '<code>' . $default_colors['footer_text'] . '</code>' ),
'id' => 'woocommerce_email_footer_text_color',
'type' => 'color',
'css' => 'width:6em;',
'default' => $default_colors['footer_text'],
'autoload' => false,
'desc_tip' => true,
),
array(
'title' => __( 'Auto-sync with theme', 'woocommerce' ),
'desc' => __( 'Automatically update email styles when theme styles change', 'woocommerce' ),
'id' => 'woocommerce_email_auto_sync_with_theme',
'type' => 'hidden',
'default' => 'no',
'autoload' => false,
),
array(
'type' => 'sectionend',
'id' => 'email_color_palette',
),
array(
'title' => __( 'Email improvements button', 'woocommerce' ),
'type' => 'email_improvements_button',
'id' => 'email_improvements_button',
),
array( 'type' => 'email_preview' ),
)
);
}
// Remove empty elements that depend on the email_improvements feature flag.
$settings = array_filter( $settings );
/**
* Filters the email settings array.
*
* @since 2.1.0
*
* @param array $settings Array of email settings.
*/
return apply_filters( 'woocommerce_email_settings', $settings );
}