Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function get( $attachmentId ) |
||
22 | { |
||
23 | $thumbnail = wp_get_attachment_image_src( $attachmentId, 'thumbnail' ); |
||
24 | |||
25 | if( !$thumbnail )return; |
||
26 | |||
27 | $medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachmentId, 'medium' ), $thumbnail ); |
||
28 | $large = $this->normalizeSrc( wp_get_attachment_image_src( $attachmentId, 'large' ), $medium ); |
||
29 | |||
30 | return (object) [ |
||
31 | 'alt' => $this->utility->cleanString( get_post_meta( $attachmentId, '_wp_attachment_image_alt', true )), |
||
32 | 'caption' => wp_get_attachment_caption( $attachmentId ), |
||
33 | 'copyright' => $this->utility->cleanString( get_post_meta( $attachmentId, '_copyright', true )), |
||
34 | 'large' => $large, |
||
35 | 'medium' => $medium, |
||
36 | 'permalink' => get_attachment_link( $attachmentId ), |
||
37 | 'thumbnail' => $this->normalizeSrc( $thumbnail ), |
||
38 | ]; |
||
39 | } |
||
40 | |||
58 |