| @@ -41,9 +41,9 @@ | ||
| 41 | 41 | * the content needs to be returned so the function parameter |
| 42 | 42 | * is to ensure the content exists. |
| 43 | 43 | * @return string Block content. |
| 44 | 44 | */ |
| 45 | - $callback = static function ( $content, $block ) use ( $args, $block_name ) { | |
| 45 | + $callback = static function( $content, $block ) use ( $args, $block_name ) { | |
| 46 | 46 | |
| 47 | 47 | // Sanity check. |
| 48 | 48 | if ( empty( $block['blockName'] ) || $block_name !== $block['blockName'] ) { |
| 49 | 49 | return $content; |
| @@ -76,65 +76,4 @@ | ||
| 76 | 76 | */ |
| 77 | 77 | add_filter( 'render_block', $callback, 10, 2 ); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | - | |
| 81 | -/** | |
| 82 | - * Registers a new block style for one or more block types. | |
| 83 | - * | |
| 84 | - * WP_Block_Styles_Registry was marked as `final` in core so it cannot be | |
| 85 | - * updated via Gutenberg to allow registration of a style across multiple | |
| 86 | - * block types as well as with an optional style object. This function will | |
| 87 | - * support the desired functionality until the styles registry can be updated | |
| 88 | - * in core. | |
| 89 | - * | |
| 90 | - * @param string|array $block_name Block type name including namespace or array of namespaced block type names. | |
| 91 | - * @param array $style_properties Array containing the properties of the style name, label, | |
| 92 | - * style_handle (name of the stylesheet to be enqueued), | |
| 93 | - * inline_style (string containing the CSS to be added), | |
| 94 | - * style_data (theme.json-like object to generate CSS from). | |
| 95 | - * | |
| 96 | - * @return bool True if all block styles were registered with success and false otherwise. | |
| 97 | - */ | |
| 98 | -function gutenberg_register_block_style( $block_name, $style_properties ) { | |
| 99 | - if ( ! is_string( $block_name ) && ! is_array( $block_name ) ) { | |
| 100 | - _doing_it_wrong( | |
| 101 | - __METHOD__, | |
| 102 | - __( 'Block name must be a string or array.', 'gutenberg' ), | |
| 103 | - '6.6.0' | |
| 104 | - ); | |
| 105 | - | |
| 106 | - return false; | |
| 107 | - } | |
| 108 | - | |
| 109 | - $block_names = is_string( $block_name ) ? array( $block_name ) : $block_name; | |
| 110 | - $result = true; | |
| 111 | - | |
| 112 | - foreach ( $block_names as $name ) { | |
| 113 | - if ( ! WP_Block_Styles_Registry::get_instance()->register( $name, $style_properties ) ) { | |
| 114 | - $result = false; | |
| 115 | - } | |
| 116 | - } | |
| 117 | - | |
| 118 | - return $result; | |
| 119 | -} | |
| 120 | - | |
| 121 | -/** | |
| 122 | - * Additional data to expose to the view script module in the Form block. | |
| 123 | - * | |
| 124 | - * @return array The script module data. | |
| 125 | - */ | |
| 126 | -function gutenberg_block_core_form_view_script_module( $data ) { | |
| 127 | - if ( ! gutenberg_is_experiment_enabled( 'gutenberg-form-blocks' ) ) { | |
| 128 | - return $data; | |
| 129 | - } | |
| 130 | - | |
| 131 | - $data['nonce'] = wp_create_nonce( 'wp-block-form' ); | |
| 132 | - $data['ajaxUrl'] = admin_url( 'admin-ajax.php' ); | |
| 133 | - $data['action'] = 'wp_block_form_email_submit'; | |
| 134 | - | |
| 135 | - return $data; | |
| 136 | -} | |
| 137 | -add_filter( | |
| 138 | - 'script_module_data_@wordpress/block-library/form/view', | |
| 139 | - 'gutenberg_block_core_form_view_script_module' | |
| 140 | -); | |