Code Modernization: Customize: Use null coalescing operator instead of isset() ternaries.
Developed as a subset of https://github.com/WordPress/wordpress-develop/pull/10654 Initially developed in https://github.com/WordPress/wordpress-develop/pull/4886 Follow-up to [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props costdev, westonruter. See #58874, #63430. Built from https://develop.svn.wordpress.org/trunk@61433 git-svn-id: http://core.svn.wordpress.org/trunk@60745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1251,7 +1251,7 @@ final class WP_Customize_Nav_Menus {
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<ul class="available-menu-items-list" data-type="<?php echo esc_attr( $available_item_type['type'] ); ?>" data-object="<?php echo esc_attr( $available_item_type['object'] ); ?>" data-type_label="<?php echo esc_attr( isset( $available_item_type['type_label'] ) ? $available_item_type['type_label'] : $available_item_type['type'] ); ?>"></ul>
|
||||
<ul class="available-menu-items-list" data-type="<?php echo esc_attr( $available_item_type['type'] ); ?>" data-object="<?php echo esc_attr( $available_item_type['object'] ); ?>" data-type_label="<?php echo esc_attr( $available_item_type['type_label'] ?? $available_item_type['type'] ); ?>"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -941,7 +941,7 @@ class WP_Customize_Setting {
|
||||
*/
|
||||
final protected function multidimensional_get( $root, $keys, $default_value = null ) {
|
||||
if ( empty( $keys ) ) { // If there are no keys, test the root.
|
||||
return isset( $root ) ? $root : $default_value;
|
||||
return $root ?? $default_value;
|
||||
}
|
||||
|
||||
$result = $this->multidimensional( $root, $keys );
|
||||
|
||||
@@ -924,7 +924,7 @@ final class WP_Customize_Widgets {
|
||||
<span class="customize-action">
|
||||
<?php
|
||||
$panel = $this->manager->get_panel( 'widgets' );
|
||||
$panel_title = isset( $panel->title ) ? $panel->title : __( 'Widgets' );
|
||||
$panel_title = $panel->title ?? __( 'Widgets' );
|
||||
/* translators: ▸ is the unicode right-pointing triangle. %s: Section title in the Customizer. */
|
||||
printf( __( 'Customizing ▸ %s' ), esc_html( $panel_title ) );
|
||||
?>
|
||||
@@ -1123,7 +1123,7 @@ final class WP_Customize_Widgets {
|
||||
$available_widget = array_merge(
|
||||
$available_widget,
|
||||
array(
|
||||
'temp_id' => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null,
|
||||
'temp_id' => $args['_temp_id'] ?? null,
|
||||
'is_multi' => $is_multi_widget,
|
||||
'control_tpl' => $control_tpl,
|
||||
'multi_number' => ( 'multi' === $args['_add'] ) ? $args['_multi_num'] : false,
|
||||
|
||||
@@ -40,8 +40,8 @@ final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting {
|
||||
if ( empty( $custom_image_header ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/class-custom-image-header.php';
|
||||
$args = get_theme_support( 'custom-header' );
|
||||
$admin_head_callback = isset( $args[0]['admin-head-callback'] ) ? $args[0]['admin-head-callback'] : null;
|
||||
$admin_preview_callback = isset( $args[0]['admin-preview-callback'] ) ? $args[0]['admin-preview-callback'] : null;
|
||||
$admin_head_callback = $args[0]['admin-head-callback'] ?? null;
|
||||
$admin_preview_callback = $args[0]['admin-preview-callback'] ?? null;
|
||||
$custom_image_header = new Custom_Image_Header( $admin_head_callback, $admin_preview_callback );
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
|
||||
// These properties are read-only and are part of the setting for use in the Customizer UI.
|
||||
if ( is_array( $value ) ) {
|
||||
$value_obj = (object) $value;
|
||||
$value['type_label'] = isset( $type_label ) ? $type_label : $this->get_type_label( $value_obj );
|
||||
$value['type_label'] = $type_label ?? $this->get_type_label( $value_obj );
|
||||
$value['original_title'] = $this->get_original_title( $value_obj );
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-alpha-61432';
|
||||
$wp_version = '7.0-alpha-61433';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user