Changeset 49234
- Timestamp:
- 10/20/2020 03:29:42 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r49223 r49234 993 993 994 994 /** 995 * Get an HTML img element representing an image attachment 995 * Get an HTML img element representing an image attachment. 996 996 * 997 997 * While `$size` will accept an array, it is better to register a size with … … 1100 1100 } 1101 1101 1102 return $html; 1102 /** 1103 * HTML img element representing an image attachment. 1104 * 1105 * @since 5.6.0 1106 * 1107 * @param string $html HTML img element or empty string on failure. 1108 * @param int $attachment_id Image attachment ID. 1109 * @param string|int[] $size Requested image size. Can be any registered image size name, or 1110 * an array of width and height values in pixels (in that order). 1111 * @param bool $icon Whether the image should be treated as an icon. 1112 * @param array $attr Array of attribute values for the image markup, keyed by attribute name. 1113 * See wp_get_attachment_image(). 1114 */ 1115 return apply_filters( 'wp_get_attachment_image', $html, $attachment_id, $size, $icon, $attr ); 1103 1116 } 1104 1117 -
trunk/tests/phpunit/tests/media.php
r49193 r49234 1342 1342 1343 1343 $this->assertSame( $expected, wp_get_attachment_image( self::$large_id ) ); 1344 } 1345 1346 /** 1347 * @ticket 50801 1348 */ 1349 function test_wp_get_attachment_image_filter_output() { 1350 $image = image_downsize( self::$large_id, 'thumbnail' ); 1351 $expected = 'Override wp_get_attachment_image'; 1352 1353 add_filter( 'wp_get_attachment_image', array( $this, 'filter_wp_get_attachment_image' ) ); 1354 $output = wp_get_attachment_image( self::$large_id ); 1355 remove_filter( 'wp_get_attachment_image', array( $this, 'filter_wp_get_attachment_image' ) ); 1356 1357 $this->assertSame( $expected, $output ); 1358 } 1359 1360 function filter_wp_get_attachment_image() { 1361 return 'Override wp_get_attachment_image'; 1344 1362 } 1345 1363
Note: See TracChangeset
for help on using the changeset viewer.