PluginProbe
Gutenberg / 13.7.2
Gutenberg v13.7.2
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 12.6.0 7.4.0 All 402 releases
gutenberg / lib / experimental / blocks.php

blocks.php in Gutenberg 13.7.2, at lib/experimental/blocks.php

31 lines 979 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Temporary compatibility shims for features present in Gutenberg.
4 *
5 * @package gutenberg
6 */
7
8 /**
9 * Returns whether the quote v2 is enabled by the user.
10 *
11 * @return boolean
12 */
13 function gutenberg_is_quote_v2_enabled() {
14 return get_option( 'gutenberg-experiments' ) && array_key_exists( 'gutenberg-quote-v2', get_option( 'gutenberg-experiments' ) );
15 }
16
17 /**
18 * Sets a global JS variable used to trigger the availability of the experimental blocks.
19 */
20 function gutenberg_enable_experimental_blocks() {
21 if ( get_option( 'gutenberg-experiments' ) && array_key_exists( 'gutenberg-list-v2', get_option( 'gutenberg-experiments' ) ) ) {
22 wp_add_inline_script( 'wp-block-library', 'window.__experimentalEnableListBlockV2 = true', 'before' );
23 }
24
25 if ( gutenberg_is_quote_v2_enabled() ) {
26 wp_add_inline_script( 'wp-block-library', 'window.__experimentalEnableQuoteBlockV2 = true', 'before' );
27 }
28 }
29
30 add_action( 'admin_init', 'gutenberg_enable_experimental_blocks' );
31