Merge pull request #3143 from woocommerce/PCP-4245-undefined-array-key-block-editor-in-styling-settings-map-helper-php-line-179

Fix the warning message related to the 'block-editor' location (4245)
This commit is contained in:
Emili Castells 2025-02-24 13:40:54 +01:00 committed by GitHub
commit 9f78224d75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -224,9 +224,10 @@ class StylingSettingsMapHelper {
protected function mapped_disabled_funding_value( array $styling_models ): ?array {
$disabled_funding = array();
$locations_to_context_map = $this->current_context_to_new_button_location_map();
$current_context = $locations_to_context_map[ $this->context() ] ?? '';
foreach ( $styling_models as $model ) {
if ( $model->location !== $locations_to_context_map[ $this->context() ] || in_array( 'venmo', $model->methods, true ) ) {
if ( $model->location !== $current_context || in_array( 'venmo', $model->methods, true ) ) {
continue;
}
@ -252,10 +253,11 @@ class StylingSettingsMapHelper {
}
$locations_to_context_map = $this->current_context_to_new_button_location_map();
$current_context = $locations_to_context_map[ $this->context() ] ?? '';
foreach ( $styling_models as $model ) {
if ( ! $model->enabled
|| $model->location !== $locations_to_context_map[ $this->context() ]
|| $model->location !== $current_context
|| ! in_array( $button_name, $model->methods, true )
) {
continue;