PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | lib/block-supports/custom-css.php +19 -1 23.6.2 → trunk View file →
@@ -7,8 +7,10 @@
7 7
8 8 /**
9 9 * Render the custom CSS stylesheet and add class name to block as required.
10 10 *
11 + * @since 7.0.0
12 + *
11 13 * @param array $parsed_block The parsed block.
12 14 * @return array The same parsed block with custom CSS class name added if appropriate.
13 15 *
14 16 * @phpstan-param array{
@@ -77,8 +79,10 @@
77 79 }
78 80
79 81 /**
80 82 * Enqueues the block custom CSS styles.
83 + *
84 + * @since 7.0.0
81 85 */
82 86 function gutenberg_enqueue_block_custom_css() {
83 87 wp_enqueue_style( 'wp-block-custom-css' );
84 88 }
@@ -88,11 +92,13 @@
88 92 *
89 93 * The class name is generated in {@see gutenberg_render_custom_css_support_styles()}
90 94 * and stored in block attributes. This filter adds it to the actual markup.
91 95 *
96 + * @since 7.0.0
97 + *
92 98 * @param string $block_content Rendered block content.
93 99 * @param array $block Block object.
94 - * @return string Filtered block content.
100 + * @return string Filtered block content.
95 101 *
96 102 * @phpstan-param array{
97 103 * attrs: array{
98 104 * className?: string,
@@ -150,8 +156,10 @@
150 156
151 157 /**
152 158 * Registers the style block attribute for block types that support it.
153 159 *
160 + * @since 7.0.0
161 + *
154 162 * @param WP_Block_Type $block_type Block Type.
155 163 */
156 164 function gutenberg_register_custom_css_support( $block_type ) {
157 165 // Setup attributes and styles within that if needed.
@@ -179,8 +187,10 @@
179 187 * Uses WP_Block_Parser::next_token() to scan block tokens and surgically
180 188 * replace only the attribute JSON that changed — no parse_blocks() +
181 189 * serialize_blocks() round-trip needed.
182 190 *
191 + * @since 7.0.0
192 + *
183 193 * @param string $content Post content to filter, expected to be escaped with slashes.
184 194 * @return string Filtered post content with block custom CSS removed.
185 195 */
186 196 function gutenberg_strip_custom_css_from_blocks( $content ) {
@@ -259,8 +269,10 @@
259 269 }
260 270
261 271 /**
262 272 * Adds the filters to strip custom CSS from block content on save.
273 + *
274 + * @since 7.0.0
263 275 * @access private
264 276 */
265 277 function gutenberg_custom_css_kses_init_filters() {
266 278 add_filter( 'content_save_pre', 'gutenberg_strip_custom_css_from_blocks', 8 );
@@ -268,8 +280,10 @@
268 280 }
269 281
270 282 /**
271 283 * Removes the filters that strip custom CSS from block content on save.
284 + *
285 + * @since 7.0.0
272 286 * @access private
273 287 */
274 288 function gutenberg_custom_css_remove_filters() {
275 289 remove_filter( 'content_save_pre', 'gutenberg_strip_custom_css_from_blocks', 8 );
@@ -277,8 +291,10 @@
277 291 }
278 292
279 293 /**
280 294 * Registers the custom CSS content filters if the user does not have the edit_css capability.
295 + *
296 + * @since 7.0.0
281 297 * @access private
282 298 */
283 299 function gutenberg_custom_css_kses_init() {
284 300 gutenberg_custom_css_remove_filters();
@@ -292,8 +308,10 @@
292 308 *
293 309 * This filter is the last being executed on force_filtered_html_on_import.
294 310 * If the input of the filter is true it means we are in an import situation and should
295 311 * enable the custom CSS filters, independently of the user capabilities.
312 + *
313 + * @since 7.0.0
296 314 * @access private
297 315 *
298 316 * @param mixed $arg Input argument of the filter.
299 317 * @return mixed Input argument of the filter.