Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow child classes to use the private methods and constants #38625

Merged
merged 2 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WP_Theme_JSON_Gutenberg {
*
* @var array
*/
private $theme_json = null;
protected $theme_json = null;

/**
* Holds block metadata extracted from block.json
Expand Down Expand Up @@ -426,7 +426,7 @@ private static function sanitize( $input, $valid_block_names, $valid_element_nam
return $output;
}

$output = array_intersect_key( $input, array_flip( self::VALID_TOP_LEVEL_KEYS ) );
$output = array_intersect_key( $input, array_flip( static::VALID_TOP_LEVEL_KEYS ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making these changes for the patterns PR ❤️


// Some styles are only meant to be available at the top-level (e.g.: blockGap),
// hence, the schema for blocks & elements should not have them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,43 @@ class WP_Theme_JSON_Resolver_Gutenberg {
*
* @var WP_Theme_JSON_Gutenberg
*/
private static $core = null;
protected static $core = null;

/**
* Container for data coming from the theme.
*
* @var WP_Theme_JSON_Gutenberg
*/
private static $theme = null;
protected static $theme = null;

/**
* Whether or not the theme supports theme.json.
*
* @var bool
*/
private static $theme_has_support = null;
protected static $theme_has_support = null;

/**
* Container for data coming from the user.
*
* @var WP_Theme_JSON_Gutenberg
*/
private static $user = null;
protected static $user = null;

/**
* Stores the ID of the custom post type
* that holds the user data.
*
* @var integer
*/
private static $user_custom_post_type_id = null;
protected static $user_custom_post_type_id = null;

/**
* Container to keep loaded i18n schema for `theme.json`.
*
* @var array
*/
private static $i18n_schema = null;
protected static $i18n_schema = null;

/**
* Processes a file that adheres to the theme.json
Expand All @@ -68,7 +68,7 @@ class WP_Theme_JSON_Resolver_Gutenberg {
* @param string $file_path Path to file. Empty if no file.
* @return array Contents that adhere to the theme.json schema.
*/
private static function read_json_file( $file_path ) {
protected static function read_json_file( $file_path ) {
$config = array();
if ( $file_path ) {
$decoded_file = wp_json_file_decode( $file_path, array( 'associative' => true ) );
Expand Down Expand Up @@ -100,7 +100,7 @@ public static function get_fields_to_translate() {
* Default 'default'.
* @return array Returns the modified $theme_json_structure.
*/
private static function translate( $theme_json, $domain = 'default' ) {
protected static function translate( $theme_json, $domain = 'default' ) {
if ( null === self::$i18n_schema ) {
$i18n_schema = wp_json_file_decode( __DIR__ . '/theme-i18n.json' );
self::$i18n_schema = null === $i18n_schema ? array() : $i18n_schema;
Expand Down Expand Up @@ -391,7 +391,7 @@ public static function theme_has_support() {
* @param bool $template Optional. Use template theme directory. Default false.
* @return string The whole file path or empty if the file doesn't exist.
*/
private static function get_file_path_from_theme( $file_name, $template = false ) {
protected static function get_file_path_from_theme( $file_name, $template = false ) {
$path = $template ? get_template_directory() : get_stylesheet_directory();
$candidate = $path . '/' . $file_name;

Expand Down