Deprecate unsupported Inbox note banner layout (#51275)

* Deprecate note banner layout

* Update doc

* Add changelog
This commit is contained in:
Chi-Hsuan Huang 2024-09-13 09:11:11 +08:00 committed by Karol Manijak
parent 5a27acbe4e
commit 2d3d9659ed
9 changed files with 21 additions and 7 deletions

View File

@ -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"
}

View File

@ -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

View File

@ -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

View File

@ -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' => '',
),

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Deprecate unsupported Inbox note banner layout

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Deprecate unsupported Inbox note banner layout

View File

@ -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 {

View File

@ -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 ) );

View File

@ -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();
}
/**