Skip to content

Commit

Permalink
Merge pull request #1756 from WordPress/fix/non-array-meta-arg
Browse files Browse the repository at this point in the history
Account for $meta arg in wp_prepare_attachment_for_js not being an array
  • Loading branch information
felixarntz authored Dec 18, 2024
2 parents f5f50f9 + c568871 commit 07fd4cf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/dominant-color-images/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,18 @@ function dominant_color_admin_script(): void {
*
* @since n.e.x.t
*
* @param array<mixed>|mixed $response The current response array for the attachment.
* @param WP_Post $attachment The attachment post object.
* @param array<mixed> $meta The attachment metadata.
* @return array<mixed> The modified response array with added dominant color and transparency information.
* @param array<string, mixed>|mixed $response The current response array for the attachment.
* @param WP_Post $attachment The attachment post object.
* @param array<string, mixed>|false $meta The attachment metadata.
* @return array<string, mixed> The modified response array with added dominant color and transparency information.
*/
function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, array $meta ): array {
function dominant_color_prepare_attachment_for_js( $response, WP_Post $attachment, $meta ): array {
if ( ! is_array( $response ) ) {
$response = array();
}
if ( ! is_array( $meta ) ) {
return $response;
}

$response['dominantColor'] = '';
if (
Expand Down

0 comments on commit 07fd4cf

Please sign in to comment.