WP_Theme_JSON_Schema::rename_settings() – Processes a settings array, renaming or moving properties.

You appear to be a bot. Output may be restricted

Description

Processes a settings array, renaming or moving properties.

Usage

WP_Theme_JSON_Schema::rename_settings( $settings, $paths_to_rename );

Parameters

$settings
( array ) required – Reference to settings either defaults or an individual block's.
$paths_to_rename
( array ) required – Paths to rename.

Returns

void

Source

File name: wordpress/wp-includes/class-wp-theme-json-schema.php
Lines:

1 to 12 of 12
  private static function rename_settings( &$settings, $paths_to_rename ) {
    foreach ( $paths_to_rename as $original => $renamed ) {
      $original_path = explode( '.', $original );
      $renamed_path  = explode( '.', $renamed );
      $current_value = _wp_array_get( $settings, $original_path, null );

      if ( null !== $current_value ) {
        _wp_array_set( $settings, $renamed_path, $current_value );
        self::unset_setting_by_path( $settings, $original_path );
      }
    }
  }
 

 View on GitHub View on Trac