Uses
| Uses | Description |
|---|---|
| wp-includes/l10n.php: __() | Retrieve the translation of $text. |
| wp-includes/functions.php: _doing_it_wrong() | Mark something as being incorrectly called. |
Registers a block style.
(string) (Required) Block type name including namespace.
(array) (Required) Array containing the properties of the style name, label, style (name of the stylesheet to be enqueued), inline_style (string containing the CSS to be added).
(boolean) True if the block style was registered with success and false otherwise.
File: wp-includes/class-wp-block-styles-registry.php
public function register( $block_name, $style_properties ) {
if ( ! isset( $block_name ) || ! is_string( $block_name ) ) {
$message = __( 'Block name must be a string.' );
_doing_it_wrong( __METHOD__, $message, '5.3.0' );
return false;
}
if ( ! isset( $style_properties['name'] ) || ! is_string( $style_properties['name'] ) ) {
$message = __( 'Block style name must be a string.' );
_doing_it_wrong( __METHOD__, $message, '5.3.0' );
return false;
}
$block_style_name = $style_properties['name'];
if ( ! isset( $this->registered_block_styles[ $block_name ] ) ) {
$this->registered_block_styles[ $block_name ] = array();
}
$this->registered_block_styles[ $block_name ][ $block_style_name ] = $style_properties;
return true;
} | Version | Description |
|---|---|
| 5.3.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_block_styles_registry/register