[wp-trac] [WordPress Trac] #30180: wp_get_attachment_image_src does not return alt or meta
WordPress Trac
noreply at wordpress.org
Tue Dec 11 09:30:25 UTC 2018
#30180: wp_get_attachment_image_src does not return alt or meta
--------------------------------------+-----------------------------
Reporter: joedolson | Owner: joedolson
Type: enhancement | Status: accepted
Priority: normal | Milestone: Future Release
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: accessibility
--------------------------------------+-----------------------------
Changes (by birgire):
* keywords: needs-patch => has-patch has-unit-tests
Comment:
@ryanshoover thanks for the patch.
I just skimmed over [attachment:"30180.1.unit-tests.patch"] and noticed
few things:
- The patch uses shorthand array notation {{{[]}}} that's only supported
in PHP 5.4+. It's on the plan to bump the minimum version to 5.6 and then
7 next year, but I don't think there's a date yet. So I would suggest
using {{{array()}}} until then.
- The concatenation in the PHP code example uses the Javascript plus
{{{+}}} instead of the dot {{{.}}}, i.e. {{{$alt = $alt + ' Extra
content';}}}
- Shouldn't we use {{{null}}} type in the {{{@return}}} as {{{null}}} is a
primitive type in PHPDoc?
- The patch does not contain all the changes made in the patch
[attachment:"30180.1.diff"]. Is there a reason for that?
- @joemcgill suggested above the function name
{{{wp_get_attachment_image_attributes()}}} but the patch uses
{{{wp_get_attachment_image_attr()}}} and same for the filter.
- @joemcgill mentioned above that the {{{wp_get_attachement_image()}}}
could be a wrapper for {{{wp_get_attachment_image_attributes()}}}, but I
didn't see that in the patch.
- It would be nice to have test cases for all the supported nine
attributes. Maybe there's a way to use a {{{@dataProvider}}}?
Hope it helps
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30180#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list