Making WordPress.org


Ignore:
Timestamp:
07/13/2020 08:19:33 PM (6 years ago)
Author:
ryelle
Message:

Plugin Directory: Add a check for block name standards

This will flag as errors any block names that would not register in the editor (using the same regex). It also checks for some common block starter content namespaces, to ensure names are unique across the repo (as warnings).

See #5303

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-block-validator.php

    r10065 r10066  
    271271                        case 'check_php_size':
    272272                                return __( 'Block plugins should keep the PHP code to a mimmum. If you need a lot of PHP code, your plugin probably belongs in the main Plugin Directory rather than the Block Directory.', 'wporg-plugins' );
     273                        case 'check_for_standard_block_name':
     274                                return [
     275                                        __( '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' ),
     276                                        __( 'Example: <code>my-plugin/my-custom-block</code>', 'wporg-plugins' ),
     277                                ];
    273278                }
    274279        }
Note: See TracChangeset for help on using the changeset viewer.