Make WordPress Core


Ignore:
Timestamp:
09/14/2019 06:20:58 PM (5 years ago)
Author:
jorgefilipecosta
Message:

Block Editor: Backport block styles server functions from block editor.

This commit backports the block styles functionality added to the block editor in https://github.com/WordPress/gutenberg/pull/16356.

Props: youknowriad, aduth, swissspidy.
Fixes #48039.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r45393 r46111  
    357357    return has_blocks( $content ) ? 1 : 0;
    358358}
     359
     360/**
     361 * Registers a new block style.
     362 *
     363 * @since 5.3.0
     364 *
     365 * @param string $block_name       Block type name including namespace.
     366 * @param array  $style_properties 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).
     367 *
     368 * @return boolean True if the block style was registered with success and false otherwise.
     369 */
     370function register_block_style( $block_name, $style_properties ) {
     371    return WP_Block_Styles_Registry::get_instance()->register( $block_name, $style_properties );
     372}
     373
     374/**
     375 * Unregisters a block style.
     376 *
     377 * @since 5.3.0
     378 *
     379 * @param string $block_name       Block type name including namespace.
     380 * @param array  $block_style_name Block style name.
     381 *
     382 * @return boolean True if the block style was unregistered with success and false otherwise.
     383 */
     384function unregister_block_style( $block_name, $block_style_name ) {
     385    return WP_Block_Styles_Registry::get_instance()->unregister( $block_name, $block_style_name );
     386}
Note: See TracChangeset for help on using the changeset viewer.