PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.0.5
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.0.5
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / widgets / gutenberg / lib / class-wp-theme-json-data-gutenberg.php
widget-options / includes / widgets / gutenberg / lib Last commit date
block-supports 2 years ago compat 2 years ago experimental 2 years ago README.md 2 years ago block-editor-settings.php 2 years ago blocks.php 2 years ago class-wp-duotone-gutenberg.php 2 years ago class-wp-theme-json-data-gutenberg.php 2 years ago class-wp-theme-json-gutenberg.php 2 years ago class-wp-theme-json-resolver-gutenberg.php 2 years ago client-assets.php 2 years ago demo.php 2 years ago experiments-page.php 2 years ago global-styles-and-settings.php 2 years ago init.php 2 years ago load.php 2 years ago script-loader.php 2 years ago theme-i18n.json 2 years ago theme.json 2 years ago upgrade.php 2 years ago
class-wp-theme-json-data-gutenberg.php
73 lines
1 <?php
2 /**
3 * WP_Theme_JSON_Data class
4 *
5 * @package gutenberg
6 * @since 6.1.0
7 */
8
9 /**
10 * Class to provide access to update a theme.json structure.
11 */
12 #[AllowDynamicProperties]
13 class WP_Theme_JSON_Data_Gutenberg {
14
15 /**
16 * Container of the data to update.
17 *
18 * @since 6.1.0
19 * @var WP_Theme_JSON
20 */
21 private $theme_json = null;
22
23 /**
24 * The origin of the data: default, theme, user, etc.
25 *
26 * @since 6.1.0
27 * @var string
28 */
29 private $origin = '';
30
31 /**
32 * Constructor.
33 *
34 * @since 6.1.0
35 *
36 * @link https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/
37 *
38 * @param array $data Array following the theme.json specification.
39 * @param string $origin The origin of the data: default, theme, user.
40 */
41 public function __construct( $data = array(), $origin = 'theme' ) {
42 $this->origin = $origin;
43 $this->theme_json = new WP_Theme_JSON_Gutenberg( $data, $this->origin );
44 }
45
46 /**
47 * Updates the theme.json with the the given data.
48 *
49 * @since 6.1.0
50 *
51 * @param array $new_data Array following the theme.json specification.
52 *
53 * @return WP_Theme_JSON_Data_Gutenberg The own instance with access to the modified data.
54 */
55 public function update_with( $new_data ) {
56 $this->theme_json->merge( new WP_Theme_JSON_Gutenberg( $new_data, $this->origin ) );
57 return $this;
58 }
59
60 /**
61 * Returns an array containing the underlying data
62 * following the theme.json specification.
63 *
64 * @since 6.1.0
65 *
66 * @return array
67 */
68 public function get_data() {
69 return $this->theme_json->get_raw_data();
70 }
71
72 }
73