Browse Source

Fix/blockbase customizer meta info (#4336)

* Add meta-info to theme user json.

* Added missing function documentation.

* Formatted function documentation.
Jason Crist 4 năm trước cách đây
mục cha
commit
c1caa60dca

+ 5 - 0
blockbase/inc/customizer/wp-customize-colors.php

@@ -133,6 +133,11 @@ class GlobalStylesColorCustomizer {
 		$user_theme_json_post         = get_post( $user_custom_post_type_id );
 		$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );
 
+		// Set meta settings.
+		$user_theme_json_post_content->version                     = 1;
+		$user_theme_json_post_content->isGlobalStylesUserThemeJSON = true;
+
+		// Set palette settings.
 		$user_theme_json_post_content = set_settings_array(
 			$user_theme_json_post_content,
 			array( 'settings', 'color', 'palette' ),

+ 4 - 0
blockbase/inc/customizer/wp-customize-fonts.php

@@ -415,6 +415,10 @@ class GlobalStylesFontsCustomizer {
 		$user_theme_json_post         = get_post( $user_custom_post_type_id );
 		$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );
 
+		// Set meta settings.
+		$user_theme_json_post_content->version                     = 1;
+		$user_theme_json_post_content->isGlobalStylesUserThemeJSON = true;
+
 		// Set the typography settings.
 		$user_theme_json_post_content = set_settings_array(
 			$user_theme_json_post_content,

+ 10 - 0
blockbase/inc/customizer/wp-customize-utils.php

@@ -1,5 +1,15 @@
 <?php
 
+/**
+ *
+ * Assign a value to an object at the given location.  Create the nested objects if they aren't already available.
+ *
+ * @param   object  $target The object to assign the value to
+ * @param   array   $array  The array describing the location of the property to update
+ * @param   object  $value  The value to assign
+ * @return  object          The modified $target object with $value assigned where $array describes
+ *
+ */
 function set_settings_array( $target, $array, $value ) {
 	$key     = array_shift( $array );
 	$current =& $target;