lib
block-supports
4 months ago
compat
3 months ago
experimental
3 months ago
media
3 months ago
README.md
10.0 KB
7 months ago
block-editor-settings.php
5.4 KB
7 months ago
block-template-utils.php
3.5 KB
1 year ago
blocks.php
11.8 KB
7 months ago
class-wp-duotone-gutenberg.php
37.6 KB
5 months ago
class-wp-icons-registry-gutenberg.php
7.1 KB
4 months ago
class-wp-rest-edit-site-export-controller-gutenberg.php
1.2 KB
2 years ago
class-wp-rest-global-styles-controller-gutenberg.php
24.5 KB
7 months ago
class-wp-rest-icons-controller-gutenberg.php
481 B
4 months ago
class-wp-theme-json-data-gutenberg.php
1.7 KB
2 years ago
class-wp-theme-json-gutenberg.php
196.1 KB
3 months ago
class-wp-theme-json-resolver-gutenberg.php
34.7 KB
6 months ago
class-wp-theme-json-schema-gutenberg.php
7.4 KB
7 months ago
client-assets.php
16.4 KB
4 months ago
demo.php
1.6 KB
1 year ago
global-styles-and-settings.php
14.2 KB
7 months ago
init.php
945 B
4 months ago
interactivity-api.php
1.2 KB
7 months ago
load.php
10.9 KB
3 months ago
mathml-kses.php
6.3 KB
10 months ago
overlay-patterns.php
12.2 KB
6 months ago
remove-core-enqueue-scripts.php
779 B
5 months ago
rest-api.php
1.6 KB
4 months ago
script-loader.php
5.9 KB
5 months ago
theme-i18n.json
1.8 KB
7 months ago
theme.json
9.2 KB
5 months ago
upgrade.php
2.6 KB
5 months ago
class-wp-theme-json-data-gutenberg.php in Gutenberg 23.2.0, at lib/class-wp-theme-json-data-gutenberg.php
| 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( 'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA ), $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 | * Return theme JSON object. |
| 74 | * |
| 75 | * @since 18.5.0 |
| 76 | * |
| 77 | * @return WP_Theme_JSON |
| 78 | */ |
| 79 | public function get_theme_json() { |
| 80 | return $this->theme_json; |
| 81 | } |
| 82 | } |
| 83 |