WC_Email::delete_template_action()protectedWC 1.0

Delete template action.

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

Хуки из метода

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->delete_template_action( $template_type );
$template_type(строка) (обязательный)
Template type.

Код WC_Email::delete_template_action() WC 8.7.0

<?php
protected function delete_template_action( $template_type ) {
	$template = $this->get_template( $template_type );

	if ( $template ) {
		if ( ! empty( $template ) ) {
			$theme_file = $this->get_theme_template_file( $template );

			if ( file_exists( $theme_file ) ) {
				unlink( $theme_file ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink

				/**
				 * Action hook fired after deleting template file.
				 *
				 * @param string $template The deleted template type
				 * @param string $email The email object
				 */
				do_action( 'woocommerce_delete_email_template', $template_type, $this );
				?>
				<div class="updated">
					<p><?php echo esc_html__( 'Template file deleted from theme.', 'woocommerce' ); ?></p>
				</div>
				<?php
			}
		}
	}
}