move edited attribute message to location consistent with other edited messages

This commit is contained in:
Ron Rennick 2020-02-25 11:28:11 -04:00
parent bfac625cdc
commit 84c2c7fb00
1 changed files with 12 additions and 1 deletions

View File

@ -15,6 +15,13 @@ defined( 'ABSPATH' ) || exit;
*/
class WC_Admin_Attributes {
/**
* Edited attribute ID.
*
* @var int
*/
private static $edited_attribute_id;
/**
* Handles output of the attributes page in admin.
*
@ -135,7 +142,7 @@ class WC_Admin_Attributes {
return $id;
}
echo '<div class="updated"><p>' . esc_html__( 'Attribute updated successfully', 'woocommerce' ) . '</p><p><a href="' . esc_url( admin_url( 'edit.php?post_type=product&amp;page=product_attributes' ) ) . '">' . esc_html__( 'Back to Attributes', 'woocommerce' ) . '</a></p></div>';
self::$edited_attribute_id = $id;
return true;
}
@ -180,6 +187,10 @@ class WC_Admin_Attributes {
if ( ! $attribute_to_edit ) {
echo '<div id="woocommerce_errors" class="error"><p>' . esc_html__( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>';
} else {
if ( self::$edited_attribute_id > 0 ) {
echo '<div id="message" class="updated"><p>' . esc_html__( 'Attribute updated successfully', 'woocommerce' ) . '</p><p><a href="' . esc_url( admin_url( 'edit.php?post_type=product&amp;page=product_attributes' ) ) . '">' . esc_html__( 'Back to Attributes', 'woocommerce' ) . '</a></p></div>';
self::$edited_attribute_id = null;
}
$att_type = $attribute_to_edit->attribute_type;
$att_label = format_to_edit( $attribute_to_edit->attribute_label );
$att_name = $attribute_to_edit->attribute_name;