<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[10078] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php: Plugin Directory: Improve feedback on block checker page</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/10078">10078</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/10078","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ryelle</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-07-17 21:15:33 +0000 (Fri, 17 Jul 2020)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Plugin Directory: Improve feedback on block checker page

This restructures the page so the flow is more clear, adds clarity to what counts as a blocker, and adds more details to all flagged issues.

See <a href="http://meta.trac.wordpress.org/ticket/5303">#5303</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassblockvalidatorphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassblockvalidatorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php    2020-07-17 04:39:41 UTC (rev 10077)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php      2020-07-17 21:15:33 UTC (rev 10078)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -47,8 +47,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                                Tools::audit_log( 'Plugin added to block directory.', $post->ID );
</span><span class="cx" style="display: block; padding: 0 10px">                                                                self::maybe_send_email_plugin_added( $post );
</span><span class="cx" style="display: block; padding: 0 10px">                                                                Plugin_Import::queue( $post->post_name, array( 'tags_touched' => array( $post->stable_tag ) ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                                echo '<div class="notice notice-success notice-alt"><p>' . __( 'Plugin added to the block directory.', 'wporg-plugins' ) . '</p></div>';
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         } elseif ( 'remove' === $_POST['block-directory-edit'] ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                                                Tools::audit_log( 'Plugin removed from block directory.', $post->ID );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                                echo '<div class="notice notice-info notice-alt"><p>' . __( 'Plugin removed from the block directory.', 'wporg-plugins' ) . '</p></div>';
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         }
</span><span class="cx" style="display: block; padding: 0 10px">                                                }
</span><span class="cx" style="display: block; padding: 0 10px">                                        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -77,8 +79,31 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Validates readme.txt contents and adds feedback.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * Render the form to add/remove the block from the directory.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @param WP_Post $plugin     The post object representing this plugin.
+        * @param bool    $has_errors Whether this plugin has errors preventing it from inclusion in the directory.
+        */
+       protected static function render_plugin_actions( $plugin, $has_errors ) {
+               echo '<form method="post">';
+               echo '<input type="hidden" name="plugin-id" value="' . esc_attr( $plugin->ID ) . '" />';
+
+               if ( self::plugin_is_in_block_directory( $plugin->post_name ) ) {
+                       echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' );
+                       // translators: %s plugin title.
+                       echo '<p><button class="button button-secondary button-large" type="submit" name="block-directory-edit" value="remove">' . sprintf( __( 'Remove %s from Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button></p>';
+               } else if ( ! $has_errors ) {
+                       echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' );
+                       // translators: %s plugin title.
+                       echo '<p><button class="button button-primary button-large" type="submit" name="block-directory-edit" value="add">' . sprintf( __( 'Add %s to Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button></p>';
+               }
+
+               echo '</form>';
+       }
+
+       /**
+        * Validates a block plugin to check that blocks are correctly registered and detectable.
+        *
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param string $plugin_url The URL of a Subversion or GitHub repository.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected static function validate_block( $plugin_url ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -91,7 +116,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                if ( $checker->repo_url && $checker->repo_revision ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        echo '<p>';
</span><span class="cx" style="display: block; padding: 0 10px">                        printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'Results for %1$s revision %2$s',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         // translators: %1$s is the repo URL, %2$s is a version number.
+                               __( 'Results for %1$s revision %2$s', 'wporg-plugins' ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 '<code>' . esc_url( $checker->repo_url ) . '</code>',
</span><span class="cx" style="display: block; padding: 0 10px">                                esc_html( $checker->repo_revision )
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -108,11 +134,46 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $has_errors = ! empty( $results_by_type['error'] );
+               $has_warnings = ! empty( $results_by_type['warning'] ) || ! empty( $block_json_issues );
+
+               if ( $has_errors ) :
+                       ?>
+                       <div class="notice notice-error notice-alt">
+                               <p><?php _e( 'Some problems were found. They need to be addressed in order for your plugin to be included in the Block Directory.', 'wporg-plugins' ); ?></p>
+                       </div>
+               <?php elseif ( $checker->slug ) : ?>
+                       <?php if ( self::plugin_is_in_block_directory( $checker->slug ) ) : ?>
+                               <div class="notice notice-info notice-alt">
+                                       <p><?php _e( 'This plugin is already in the Block Directory.', 'wporg-plugins' ); ?></p>
+                               </div>
+                       <?php elseif ( $has_warnings ) : ?>
+                               <div class="notice notice-info notice-alt">
+                                       <p><?php _e( 'You can add your plugin to the Block Directory.', 'wporg-plugins' ); ?></p>
+                               </div>
+                       <?php else : ?>
+                               <div class="notice notice-success notice-alt">
+                                       <p><?php _e( 'No issues were found. You can add your plugin to the Block Directory.', 'wporg-plugins' ); ?></p>
+                               </div>
+                       <?php endif; ?>
+               <?php else : ?>
+                       <div class="notice notice-info notice-alt">
+                               <p>
+                                       <?php
+                                       printf(
+                                               __( 'Your plugin passed the checks, but only plugins hosted on WordPress.org can be added to the Block Directory. <a href="%s">Upload your plugin to the WordPress.org repo,</a> then come back here to add it to the Block Directory.', 'wporg-plugins' ),
+                                               esc_url( home_url( 'developers' ) )
+                                       );
+                                       ?>
+                               </p>
+                       </div>
+                       <?php
+               endif;
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( $checker->slug ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $plugin = Plugin_Directory::get_plugin_post( $checker->slug );
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( current_user_can( 'edit_post', $plugin->ID ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                // Plugin reviewers etc
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                echo '<form method="post">';
</del><span class="cx" style="display: block; padding: 0 10px">                                 echo '<h3>' . __( 'Plugin Review Tools', 'wporg-plugins' ) . '</h3>';
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<ul>';
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<li><a href="' . get_edit_post_link( $plugin->ID ) . '">' . __( 'Edit plugin', 'wporg-plugins' ) . '</a></li>';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,77 +180,48 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<li><a href="' . esc_url( 'https://plugins.trac.wordpress.org/browser/' . $checker->slug . '/trunk' ) . '">' . __( 'Trac browser', 'wporg-plugins' ) . '</a></li>';
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '</ul>';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' );
-                               echo '<input type="hidden" name="plugin-id" value="' . esc_attr( $plugin->ID ) . '" />';
-                               echo '<p>';
-                               if ( ! empty( $results_by_type['error'] ) ) {
-                                       // translators: %s plugin title.
-                                       printf( __( "%s can't be added to the block directory, due to errors in validation.", 'wporg-plugins' ), $plugin->post_title );
-                               } else if ( self::plugin_is_in_block_directory( $checker->slug ) ) {
-                                       // translators: %s plugin title.
-                                       echo '<button class="button button-secondary button-large" type="submit" name="block-directory-edit" value="remove">' . sprintf( __( 'Remove %s from Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
-                               } else {
-                                       // translators: %s plugin title.
-                                       echo '<button class="button button-primary button-large" type="submit" name="block-directory-edit" value="add">' . sprintf( __( 'Add %s to Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
-                               }
-                               echo '</p>';
-                               echo '</form>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         self::render_plugin_actions( $plugin, $has_errors );
</ins><span class="cx" style="display: block; padding: 0 10px">                         } elseif ( current_user_can( 'plugin_admin_edit', $plugin->ID ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                // Plugin committers
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                echo '<form method="post">';
</del><span class="cx" style="display: block; padding: 0 10px">                                 echo '<h3>' . __( 'Committer Tools', 'wporg-plugins' ) . '</h3>';
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<ul>';
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '<li><a href="' . esc_url( 'https://plugins.trac.wordpress.org/browser/' . $checker->slug . '/trunk' ) . '">' . __( 'Browse code on trac', 'wporg-plugins' ) . '</a></li>';
</span><span class="cx" style="display: block; padding: 0 10px">                                echo '</ul>';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                echo wp_nonce_field( 'block-directory-edit-' . $plugin->ID, 'block-directory-nonce' );
-                               echo '<input type="hidden" name="plugin-id" value="' . esc_attr( $plugin->ID ) . '" />';
-                               echo '<p>';
-                               if ( ! empty( $results_by_type['error'] ) ) {
-                                       // translators: %s plugin title.
-                                       printf( __( "%s can't be added to the block directory, due to errors in validation.", 'wporg-plugins' ), $plugin->post_title );
-                               } else if ( self::plugin_is_in_block_directory( $checker->slug ) ) {
-                                       // translators: %s plugin title.
-                                       echo '<button class="button button-secondary button-large" type="submit" name="block-directory-edit" value="remove">' . sprintf( __( 'Remove %s from Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
-                               } else {
-                                       // translators: %s plugin title.
-                                       echo '<button class="button button-primary button-large" type="submit" name="block-directory-edit" value="add">' . sprintf( __( 'Add %s to Block Directory', 'wporg-plugins' ), $plugin->post_title ) . '</button>';
-                               }
-                               echo '</p>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         self::render_plugin_actions( $plugin, $has_errors );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $output = '';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( empty( $results_by_type['error'] ) ) {
-                       $output .= '<h3>' . __( 'Success', 'wporg-plugins' ) . '</h3>';
-                       $output .= "<div class='notice notice-success notice-alt'>\n";
-                       if ( $checker->slug && self::plugin_is_in_block_directory( $checker->slug ) ) {
-                               $output .= '<p>' . __( 'No problems were found. This plugin is already in the Block Directory.', 'wporg-plugins' ) . '</p>';
-                       } else {
-                               $output .= '<p>' . __( 'No problems were found. Your plugin has passed the first step towards being included in the Block Directory.', 'wporg-plugins' ) . '</p>';
-                       }
-                       $output .= "</div>\n";
-               } else {
-                       $output .= '<h3>' . __( 'Problems were encountered', 'wporg-plugins' ) . '</h3>';
-                       $output .= "<div class='notice notice-error notice-alt'>\n";
-                       $output .= '<p>' . __( 'Some problems were found. They need to be addressed before your plugin will work in the Block Directory.', 'wporg-plugins' ) . '</p>';
-                       $output .= "</div>\n";
-               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $error_types = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'error'   => __( 'Fatal Errors:', 'wporg-plugins' ),
-                       'warning' => __( 'Warnings:', 'wporg-plugins' ),
-                       'info'    => __( 'Notes:', 'wporg-plugins' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'error'   => array(
+                               'title' => __( 'Fatal Errors', 'wporg-plugins' ),
+                               'description' => __( 'These issues must be fixed before this block can appear in the block directory.', 'wporg-plugis' ),
+                       ),
+                       'warning' => array(
+                               'title' => __( 'Recommendations', 'wporg-plugins' ),
+                               'description' => __( 'These are suggestions to improve your block. While they are not required for your block plugin to be added to the Block Directory, addressing them will help people discover and use your block.', 'wporg-plugins' ),
+                       ),
+                       'info'    => array(
+                               'title' => __( 'Notes', 'wporg-plugins' ),
+                               'description' => false,
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                foreach ( $error_types as $type => $warning_label ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         foreach ( $error_types as $type => $labels ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         if ( empty( $results_by_type[ $type ] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         // Print out the warning wrapper if we have block.json issues.
+                               if ( 'warning' !== $type || empty( $block_json_issues ) ) {
+                                       continue;
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $output .= "<h3>{$warning_label}</h3>\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $output .= "<h3>{$labels['title']}</h3>\n";
+                       if ( $labels['description'] ) {
+                               $output .= "<p class='small'>{$labels['description']}</p>\n";
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                         $output .= "<div class='notice notice-{$type} notice-alt'>\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        foreach ( $results_by_type[ $type ] as $item ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 foreach ( (array) $results_by_type[ $type ] as $item ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Only get details if this is a warning or error.
</span><span class="cx" style="display: block; padding: 0 10px">                                $details = ( 'info' === $type ) ? false : self::get_detailed_help( $item->check_name, $item );
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( $details ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -231,14 +263,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public static function get_detailed_help( $method, $result ) {
</span><span class="cx" style="display: block; padding: 0 10px">                switch ( $method ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // These don't need more details.
</del><span class="cx" style="display: block; padding: 0 10px">                         case 'check_readme_exists':
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                return [
+                                       __( 'All plugins need a readme.txt file.', 'wporg-plugins' ),
+                                       sprintf(
+                                               '<a href="%1$s">%2$s</a>',
+                                               esc_url( home_url( 'developers/#readme' ) ),
+                                               __( 'Learn more about readmes.', 'wporg-plugins' )
+                                       ),
+                               ];
</ins><span class="cx" style="display: block; padding: 0 10px">                         case 'check_license':
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                return [
+                                       __( 'Plugins should include a GPL-compatible license in either readme.txt or the plugin headers.', 'wporg-plugins' ),
+                                       sprintf( '<a href="https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#1-plugins-must-be-compatible-with-the-gnu-general-public-license">%s</a>', __( 'Learn more about readmes.', 'wporg-plugins' ) ),
+                               ];
</ins><span class="cx" style="display: block; padding: 0 10px">                         case 'check_plugin_headers':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                return false;
-                       // This is a special case, since multiple values may be collapsed.
-                       case 'check_block_json_is_valid':
-                               return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         return sprintf( '<a href="https://developer.wordpress.org/plugins/plugin-basics/header-requirements/">%s</a>', __( 'Learn more about plugin headers.', 'wporg-plugins' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         case 'check_block_tag':
</span><span class="cx" style="display: block; padding: 0 10px">                                return __( 'The readme.txt file must contain the tag "block" (singular) for this to be added to the block directory.', 'wporg-plugins' );
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'check_for_duplicate_block_name':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -253,7 +293,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                return [
</span><span class="cx" style="display: block; padding: 0 10px">                                        __( 'In order to work in the Block Directory, a plugin must register a block. Generally one per plugin (multiple blocks may be permitted if those blocks are interdependent, such as a list block that contains list item blocks).', 'wporg-plugins' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        __( 'If your plugin doesn’t register a block, it probably belongs in the main Plugin Directory rather than the Block Directory.', 'wporg-plugins' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        sprintf( '<a href="TUTORIAL">%s</a>', __( 'Learn how to create a block.' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 sprintf( '<a href="https://developer.wordpress.org/block-editor/tutorials/create-block/">%s</a>', __( 'Learn how to create a block.' ) ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ];
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'check_for_block_json':
</span><span class="cx" style="display: block; padding: 0 10px">                                return __( 'Your plugin should contain at least one <code>block.json</code> file. This file contains metadata describing the block and its JavaScript and CSS assets. Make sure you include at least one <code>script</code> or <code>editorScript</code> item.', 'wporg-plugins' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -273,6 +313,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        __( 'Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. The namespace should be unique to your block plugin, make sure to change any defaults from block templates like "create-block/" or "cgb/".', 'wporg-plugins' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        __( 'Example: <code>my-plugin/my-custom-block</code>', 'wporg-plugins' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ];
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        case 'check_for_single_parent':
+                               return __( 'Block plugins should contain a single main block, which is added to the editor when the block is installed. If multiple blocks are used (ex: list items in a list block), the list items should set the `parent` property in their `block.json` file.', 'wporg-plugins' );
+                       // This is a special case, since multiple values may be collapsed.
+                       case 'check_block_json_is_valid':
+                               return false;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>