Make WordPress Core

Changeset 56316


Ignore:
Timestamp:
07/27/2023 09:16:53 AM (16 months ago)
Author:
audrasjb
Message:

Editor: Prevent PHP warning when accessing icon by area.

This changeset prevents an attempt to access an array via a key that doesn't exist.
See https://github.com/WordPress/gutenberg/pull/52961.

Props aaronrobertshaw, glendaviesnz, mukesh27.
Fixes #58920.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/template-part.php

    r56255 r56316  
    251251            ),
    252252            'scope'       => array( 'inserter' ),
    253             'icon'        => $icon_by_area[ $template_part->area ],
     253            'icon'        => isset( $icon_by_area[ $template_part->area ] ) ? $icon_by_area[ $template_part->area ] : null,
    254254            'example'     => array(
    255255                'attributes' => array(
Note: See TracChangeset for help on using the changeset viewer.