Deprecate unsupported Inbox note banner layout (#51275)
* Deprecate note banner layout * Update doc * Add changelog
This commit is contained in:
parent
f89366033d
commit
2cbb9d59bc
|
@ -727,7 +727,7 @@
|
|||
"menu_title": "Implement merchant onboarding",
|
||||
"tags": "how-to",
|
||||
"edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/extension-development/handling-merchant-onboarding.md",
|
||||
"hash": "c73e3c5015e6cda3be9ebd2d5fbda590ac9fa599e5fb02163c971c01060970ad",
|
||||
"hash": "85fc7d70f47fdb195ad2c690d3b95565169221f9e4d7afa98e88f3824ad0e267",
|
||||
"url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/extension-development/handling-merchant-onboarding.md",
|
||||
"id": "89fe15dc232379f546852822230c334d3d940b93"
|
||||
},
|
||||
|
@ -1804,5 +1804,5 @@
|
|||
"categories": []
|
||||
}
|
||||
],
|
||||
"hash": "1f651a59399c34644d2f91a0366bbd01da2c7dc677a1c53329b184badd3b8d13"
|
||||
"hash": "77c102c35a45b0681e7b70def9d639d764e4e5068121c2ef4dd23477c0f8784c"
|
||||
}
|
|
@ -448,7 +448,7 @@ class ExampleNote {
|
|||
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
|
||||
|
||||
// Set the type of layout the note uses. Supported layout types are:
|
||||
// 'banner', 'plain', 'thumbnail'
|
||||
// 'plain', 'thumbnail'
|
||||
$note->set_layout( 'plain' );
|
||||
|
||||
// Set the image for the note. This property renders as the src
|
||||
|
|
|
@ -83,7 +83,7 @@ class SimpleInboxNote {
|
|||
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
|
||||
|
||||
// Set the type of layout the note uses. Supported layout types are:
|
||||
// 'banner', 'plain', 'thumbnail'.
|
||||
// 'plain', 'thumbnail'.
|
||||
$note->set_layout( 'plain' );
|
||||
|
||||
// Set the image for the note. This property renders as the src
|
||||
|
|
|
@ -73,7 +73,6 @@ function get_mock_note_data() {
|
|||
return array(
|
||||
'content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud.',
|
||||
'info' => array(
|
||||
'banner' => $plugin_url . 'images/admin-notes/banner.jpg',
|
||||
'thumbnail' => $plugin_url . 'images/admin-notes/thumbnail.jpg',
|
||||
'plain' => '',
|
||||
),
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
|
||||
Deprecate unsupported Inbox note banner layout
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
|
||||
Deprecate unsupported Inbox note banner layout
|
|
@ -579,6 +579,11 @@ class Note extends \WC_Data {
|
|||
$layout = 'plain';
|
||||
}
|
||||
$valid_layouts = array( 'banner', 'plain', 'thumbnail' );
|
||||
|
||||
if ( 'banner' === $layout ) {
|
||||
wc_deprecated_argument( 'Note::set_layout', '9.4.0', 'The "banner" layout is deprecated. Please use "thumbnail" instead to display a image.' );
|
||||
}
|
||||
|
||||
if ( in_array( $layout, $valid_layouts, true ) ) {
|
||||
$this->set_prop( 'layout', $layout );
|
||||
} else {
|
||||
|
|
|
@ -72,6 +72,9 @@ class SpecRunner {
|
|||
if ( isset( $spec->source ) ) {
|
||||
$note->set_source( $spec->source );
|
||||
}
|
||||
if ( isset( $spec->layout ) ) {
|
||||
$note->set_layout( $spec->layout );
|
||||
}
|
||||
|
||||
// Recreate actions.
|
||||
$note->set_actions( self::get_actions( $spec ) );
|
||||
|
|
|
@ -60,7 +60,7 @@ class WC_Helper_Admin_Notes {
|
|||
$note_2->set_source( 'PHPUNIT_TEST' );
|
||||
$note_2->set_status( Note::E_WC_ADMIN_NOTE_ACTIONED );
|
||||
$note_2->set_is_snoozable( true );
|
||||
$note_2->set_layout( 'banner' );
|
||||
$note_2->set_layout( 'thumbnail' );
|
||||
$note_2->set_image( 'https://an-image.jpg' );
|
||||
// This note has no actions.
|
||||
$note_2->save();
|
||||
|
@ -100,7 +100,6 @@ class WC_Helper_Admin_Notes {
|
|||
'?s=PHPUNIT_TEST_NOTE_4_ACTION_2_URL'
|
||||
);
|
||||
$note_4->save();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue