WC_Email::move_template_action
Move template action.
Method of the class: WC_Email{}
Hooks from the method
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->move_template_action( $template_type );
- $template_type(string) (required)
- Template type.
WC_Email::move_template_action() WC Email::move template action code WC 10.6.2
<?php
protected function move_template_action( $template_type ) {
$template = $this->get_template( $template_type );
if ( ! empty( $template ) ) {
$theme_file = $this->get_theme_template_file( $template );
if ( wp_mkdir_p( dirname( $theme_file ) ) && ! file_exists( $theme_file ) ) {
// Locate template file.
$core_file = $this->template_base . $template;
$template_file = apply_filters( 'woocommerce_locate_core_template', $core_file, $template, $this->template_base, $this->id );
// Copy template file.
copy( $template_file, $theme_file );
/**
* Action hook fired after copying email template file.
*
* @param string $template_type The copied template type
* @param string $email The email object
*/
do_action( 'woocommerce_copy_email_template', $template_type, $this );
wc_clear_template_cache();
?>
<div class="updated">
<p><?php echo esc_html__( 'Template file copied to theme.', 'woocommerce' ); ?></p>
</div>
<?php
}
}
}