Skip to content

Commit 4fdf1e9

Browse files
westonruterreverb256Gilmoursab1ink0
authored
Merge pull request #2480 from Gilmoursa/fix/2442-modern-image-format-faq-link
Modern Image Formats: link to FAQ from settings section Co-authored-by: reverb256 <reverb256@users.noreply.github.com> Co-authored-by: Gilmoursa <gilmoursa@git.wordpress.org> Co-authored-by: westonruter <westonruter@git.wordpress.org> Co-authored-by: b1ink0 <b1ink0@git.wordpress.org>
2 parents 879e67b + c7e6f1d commit 4fdf1e9

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

‎plugins/webp-uploads/settings.php‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,19 @@ function webp_uploads_add_media_settings_fields(): void {
7979
add_settings_section(
8080
'perflab_modern_image_format_settings',
8181
_x( 'Modern Image Formats', 'settings page section name', 'webp-uploads' ),
82-
'__return_empty_string',
82+
static function (): void {
83+
printf(
84+
'<p>%s</p>',
85+
wp_kses(
86+
sprintf(
87+
/* translators: %s: URL to the plugin FAQ on WordPress.org */
88+
__( 'If modern format images are not being generated after upload, see the <a href="%s">FAQ</a> for common reasons.', 'webp-uploads' ),
89+
'https://wordpress.org/plugins/webp-uploads/#faq'
90+
),
91+
array( 'a' => array( 'href' => array() ) )
92+
)
93+
);
94+
},
8395
'media',
8496
array(
8597
'before_section' => '<div id="modern-image-formats">',

‎plugins/webp-uploads/tests/test-settings.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@
77

88
class Test_WebP_Uploads_Settings extends WP_UnitTestCase {
99

10+
/**
11+
* @covers ::webp_uploads_add_media_settings_fields
12+
*/
13+
public function test_webp_uploads_add_media_settings_fields_section_description(): void {
14+
global $wp_settings_sections;
15+
webp_uploads_add_media_settings_fields();
16+
17+
$callback = $wp_settings_sections['media']['perflab_modern_image_format_settings']['callback'];
18+
$this->assertIsCallable( $callback );
19+
20+
$processor = new WP_HTML_Tag_Processor( get_echo( $callback ) );
21+
$this->assertTrue( $processor->next_tag( 'A' ) );
22+
$this->assertSame( 'https://wordpress.org/plugins/webp-uploads/#faq', $processor->get_attribute( 'href' ) );
23+
}
24+
1025
/**
1126
* @covers ::webp_uploads_add_settings_action_link
1227
*/

0 commit comments

Comments
 (0)