Uma área de pesquisa sobre o WordPress para devs e autores do tema



get_block_editor_server_block_settings ›

Desde5.0.0
Obsoleton/a
get_block_editor_server_block_settings ( Sem parâmetros )
Retorna:
  • (array) An associative array of registered block data.
Definido em:
Codex:

Prepares server-registered blocks for the block editor.

Returns an associative array of registered block data keyed by block name. Data includes properties of a block relevant for client registration.



Fonte

function get_block_editor_server_block_settings() {
	$block_registry = WP_Block_Type_Registry::get_instance();
	$blocks         = array();
	$keys_to_pick   = array( 'title', 'description', 'icon', 'category', 'keywords', 'supports', 'attributes' );

	foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {
		foreach ( $keys_to_pick as $key ) {
			if ( ! isset( $block_type->{ $key } ) ) {
				continue;
			}

			if ( ! isset( $blocks[ $block_name ] ) ) {
				$blocks[ $block_name ] = array();
			}

			$blocks[ $block_name ][ $key ] = $block_type->{ $key };
		}
	}

	return $blocks;
}