← All changes
|
backend/src/Data/Transformers/AttachmentTransformer.php
+4
-4
0.3.0
→
1.5.5.1
View file →
| @@ -22,9 +22,9 @@ | ||
| 22 | 22 | $thumb_src = wp_get_attachment_image_src( $attachment->ID, 'thumbnail' ); |
| 23 | 23 | $thumb = $thumb_src ? $thumb_src[0] : null; |
| 24 | 24 | |
| 25 | 25 | $response = [ |
| 26 | - 'alt' => $meta['title'], | |
| 26 | + 'alt' => $meta['alt'], | |
| 27 | 27 | 'author' => get_the_author_meta( 'display_name', $attachment->post_author ), |
| 28 | 28 | 'commentsAllowed' => 'open' === $attachment->comment_status ? true : false, |
| 29 | 29 | 'date' => get_the_date( '', $attachment ), |
| 30 | 30 | 'description' => $meta['description'], |
| @@ -44,15 +44,15 @@ | ||
| 44 | 44 | 'url' => $meta['url'], |
| 45 | 45 | 'urls' => [ |
| 46 | 46 | 'medium' => $size ? $size[0] : null, |
| 47 | 47 | ], |
| 48 | - 'height' => $meta['height'], | |
| 49 | - 'width' => $meta['width'], | |
| 48 | + 'height' => isset( $meta['height'] ) ? $meta['height'] : null, | |
| 49 | + 'width' => isset( $meta['width'] ) ? $meta['width'] : null, | |
| 50 | 50 | 'orientation' => isset( $meta['orientation'] ) ? $meta['orientation'] : null, |
| 51 | 51 | ]; |
| 52 | 52 | |
| 53 | 53 | // Labels |
| 54 | - $labels = $this->notations->get_labels( 'post', $attachment->ID ); | |
| 54 | + $labels = $this->notations->get_labels( 'attachment', $attachment->ID ); | |
| 55 | 55 | foreach ( $labels as $label ) { |
| 56 | 56 | $response['labels'][] = $label['label_id']; |
| 57 | 57 | } |
| 58 | 58 | |