WC_Settings_Emails::email_notification_setting()publicWC 1.0

Output email notification settings.

Метод класса: WC_Settings_Emails{}

Возвращает

null. Ничего (null).

Использование

$WC_Settings_Emails = new WC_Settings_Emails();
$WC_Settings_Emails->email_notification_setting();

Код WC_Settings_Emails::email_notification_setting() WC 8.7.0

<?php
public function email_notification_setting() {
	// Define emails that can be customised here.
	$mailer          = WC()->mailer();
	$email_templates = $mailer->get_emails();

	?>
	<tr valign="top">
	<td class="wc_emails_wrapper" colspan="2">
		<table class="wc_emails widefat" cellspacing="0">
			<thead>
				<tr>
					<?php
					$columns = apply_filters(
						'woocommerce_email_setting_columns',
						array(
							'status'     => '',
							'name'       => __( 'Email', 'woocommerce' ),
							'email_type' => __( 'Content type', 'woocommerce' ),
							'recipient'  => __( 'Recipient(s)', 'woocommerce' ),
							'actions'    => '',
						)
					);
					foreach ( $columns as $key => $column ) {
						echo '<th class="wc-email-settings-table-' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
					}
					?>
					</tr>
				</thead>
				<tbody>
					<?php
					foreach ( $email_templates as $email_key => $email ) {
						echo '<tr>';

						foreach ( $columns as $key => $column ) {

							switch ( $key ) {
								case 'name':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
									<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( $email_key ) ) ) . '">' . esc_html( $email->get_title() ) . '</a>
									' . wc_help_tip( $email->get_description() ) . '
								</td>';
									break;
								case 'recipient':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
									' . esc_html( $email->is_customer_email() ? __( 'Customer', 'woocommerce' ) : $email->get_recipient() ) . '
								</td>';
									break;
								case 'status':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">';

									if ( $email->is_manual() ) {
										echo '<span class="status-manual tips" data-tip="' . esc_attr__( 'Manually sent', 'woocommerce' ) . '">' . esc_html__( 'Manual', 'woocommerce' ) . '</span>';
									} elseif ( $email->is_enabled() ) {
										echo '<span class="status-enabled tips" data-tip="' . esc_attr__( 'Enabled', 'woocommerce' ) . '">' . esc_html__( 'Yes', 'woocommerce' ) . '</span>';
									} else {
										echo '<span class="status-disabled tips" data-tip="' . esc_attr__( 'Disabled', 'woocommerce' ) . '">-</span>';
									}

									echo '</td>';
									break;
								case 'email_type':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
									' . esc_html( $email->get_content_type() ) . '
								</td>';
									break;
								case 'actions':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
									<a class="button alignright" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( $email_key ) ) ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>
								</td>';
									break;
								default:
									do_action( 'woocommerce_email_setting_column_' . $key, $email );
									break;
							}
						}

						echo '</tr>';
					}
					?>
				</tbody>
			</table>
		</td>
	</tr>
	<?php
}